Another AIX build problem

Jos Backus Jos.Backus at nl.origin-it.com
Fri Nov 19 10:26:09 CET 1999


On Fri, Nov 19, 1999 at 08:44:25AM +0100, Werner Koch wrote:
> 
> #define HEXTOBIN(a) ( (a) >= '0' && (a) <= '9' ? ((a)-'0') : \
>                       (a) >= 'A' && (a) <= 'F' ? ((a)-'A'+10) : ((a)-'a'+10))
> 
> What's wrong with this macro?

            line[fprlen++] = HEXTOBIN(p[0]) * 16 + HEXTOBIN(p[1]);

is expanded into

            line[fprlen++] = ( (p[0]) >= '0' && (p[0]) <= '9' ? ((p[0])-'0') :
 (p[0]) >= 'A' && (p[0]) <= 'F' ? ((p[0])-'A'+10) : ((p[0])-'p[0]'+10)) * 16 +
 ( (p[1]) >= '0' && (p[1]) <= '9' ? ((p[1])-'0') : (p[1]) >= 'A' && (p[1]) <= 'F'
 ? ((p[1])-'A'+10) : ((p[1])-'p[1]'+10));

Note the 'p[1]'.
Testing reveals that GNU cpp gives the same output when called with the
``-traditional'' option (which is what the FreeBSD cpp wrapper in /usr/bin
happens to do). When this option is omitted, cpp yields the expected output.

To prevent this from being a problem, I would like to suggest that this macro
be changed into

  #define HEXTOBIN(x) ( (x) >= '0' && (x) <= '9' ? ((x)-'0') : \
                        (x) >= 'A' && (x) <= 'F' ? ((x)-'A'+10) : ((x)-'a'+10))

> > -Wl,-export-dynamic is wrong?
> 
> Remove it - it is only needed for dlopened modules (simply cut an
> paste the command to the cmdline)

Done. I now have a working binary :-)

Thanks again for your help, Werner.


Grüss,
-- 
Jos Backus                          _/ _/_/_/  "Reliability means never
                                   _/ _/   _/   having to say you're sorry."
                                  _/ _/_/_/             -- D. J. Bernstein
                             _/  _/ _/    _/
Jos.Backus at nl.origin-it.com  _/_/  _/_/_/      use Std::Disclaimer;



More information about the Gnupg-devel mailing list