[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
protochk and C++
For a while I've been seeing consistent smoke failures with C++ on
Debian, eg:
http://www.nntp.perl.org/group/perl.daily-build.reports/2008/09/msg59862.html
http://www.nntp.perl.org/group/perl.daily-build.reports/2008/09/msg59830.html
http://www.nntp.perl.org/group/perl.daily-build.reports/2008/09/msg59795.html
I finally tracked down the cause.
Configure is detecting the strerror_r() prototype as I_IBI instead of
the correct B_IBW. ie.
strerror_r_proto='REENTRANT_PROTO_I_IBI'
This seems to be happening due to C++ overloading, the check for I_IBW
fails (correctly) because C<int strerror_r(int, char*,size_t);> is
ambiguous with C<const char *strerror_r(int, char*,size_t);> but I_IBI
succeeds (incorrectly for our purpose) because the parameter is
different, not the return type.
eg. (protochk modified to keep try.c):
sh-3.1$ ./protochk 'extern int strerror_r(int, char*,size_t);' define sys/types.h define stdio.h define string.h && echo yes
sh-3.1$ g++ -c try.c
try.c:10: error: new declaration ‘int strerror_r(int, char*, size_t)’
/usr/include/string.h:282: error: ambiguates old declaration ‘char* strerror_r(int, char*, size_t)’
sh-3.1$ ./protochk 'extern int strerror_r(int, char*, int);' define sys/types.h define stdio.h define string.h && echo yes
yes
sh-3.1$ g++ -c try.c
sh-3.1$ ./protochk 'extern char *strerror_r(int, char*, size_t);' define sys/types.h define stdio.h define string.h && echo yes
yes
sh-3.1$ g++ -c try.c
sh-3.1$
Unfortunately I can't see a way to reliably detect the prototype in
the face of C++ - reordering the checks would fix the detection for
this platform, but might break them on another platform.
Maybe the Configure gods have an idea.
Tony
- Follow-Ups from:
-
"H.Merijn Brand" <h.m.brand@xs4all.nl>
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]