[xmlsec] Little logic error
aleksey at aleksey.com
Mon Oct 21 09:22:27 PDT 2002
The problem is that if the new compiler does not support __FUNCTION__ and
we do not have it in the list
#if defined(__A_COMPILER__) && (__A_COMPILER__ < X)
#define __FUNCTION__ ""
then there eill be misterious errors during compilation like:
..\src\bn.c(208) : warning C4024: 'xmlSecError' : different types for
actual parameter 3
IMHO, in all cases we will need to list either all compilers that
or all compilers that do not support __FUNCTIN__ :( I think the question
is which list
is bigger and it looks like now we have only one compiler that does not
(MSC < 0013).
So you win :)
Thanks for taking care of this!
Igor Zlatkovic wrote:
> That is the inverted logic which gives the same pain: every compiler
> having __FUNCTION__ will need to be included in the first predicate.
> For example, if Borland, Watcom, Symantec, Forte and IBM do support it
> at least since some version, it becomes
> #if defined(__GNUC__) || (_MSC_VER >= 1300) || \
> (__BORLANDC__ >= 4) || (_WATCOM >= 5213) || \
> defined(__NORTONC__) || defined(__SUNC__) || \
> (_IBM_AIX_C_COMPILER_WHATEVER >= 123123) ...
> and that results in exactly the mess I wanted to avoid :-)
> Having one conditional per compiler which has problems with
> __FUNCTION__ would make things a little bit more readable. Okay, GNUC
> and MSVC might be the only compilers used for xmlsec today, but
> history shows this can change very rapidly.
> Aleksey Sanin wrote:
>> What about:
>> #if defined (__GNUC__) || (_MSC_VER >= 1300)
>> #define DUMMY
>> #define __FUNCTION__ ""
>> Igor Zlatkovic wrote:
>>> Hi there,
>>> There is a small error of mine in include/xmlsec/errors.h regarding the
>>> __FUNCTION__ logic. The current predicate is
>>> #if !defined(__GNUC__) || (_MSC_VER >= 1300)
>>> which I wrongly assumed would work, on a gloomy day well past
>>> midnight. In
>>> fact, this predicate always fires on everything other than GNUC,
>>> __GNUC__ is not defined.
>>> The truth is, that the correct predicate cannot be conducted
>>> generally, but
>>> every offending compiler must bring its own toys. That brings us to
>>> something like
>>> #if defined(__A_COMPILER__) && (__A_COMPILER__ < X)
>>> #define __FUNCTION__ ""
>>> with "__A_COMPILER__" being whatever the current compiler
>>> predefines. Every
>>> compiler brand which does not support __FUNCTION__ will need its own
>>> construct like the above.
>>> I now fixed the predicate to handle the MSVC compiler version lower
>>> than 13.
>>> If there is someone using a compiler other than GNUC or MSVC, please
>>> drop me
>>> a correct predicate for your compiler, if it doesn't support the
>>> __FUNCTION__ macro.
>>> Or does someone have a better idea?
> xmlsec mailing list
> xmlsec at aleksey.com
More information about the xmlsec