On Sun, 2010-10-17 at 09:32 +0200, Bart Van Assche wrote:
> On Sun, Oct 17, 2010 at 3:18 AM, Magnus Fromreide
> <[email protected]> wrote:
>         On Sat, 2010-10-16 at 23:52 +0200, Magnus Fromreide wrote:
>         > I found this in r19458
>         >
>         > #if defined(__GNUC__)
>         > typedef unsigned long netsnmp_uintptr_t;
>         > #else
>         > typedef uintptr_t netsnmp_uintptr_t;
>         > #endif
>         > #ifndef __cplusplus
>         > enum {
>         >     netsnmp_compile_time_uintptr_t_size_check
>         >     = sizeof(struct { int:-!(sizeof(netsnmp_uintptr_t) >=
>         sizeof(void*)); })
>         > };
>         > #endif
>         >
>         > and ended up very confused. I would like to see a motivation
>         for this
>         > oddity. GNU C do define uintptr_t in inttypes.h and autoconf
>         checks for
>         > it and defines it if needed so what is the point of
>         netsnmp_uintptr_t?
>         
>         
>         Oh yes, this patch additionally breaks builds on Solaris 10
>         using
>         Sun C 5.7.
> 
> Regarding the motivation for introducing netsnmp_uintptr_t: you should
> know that not all platforms supported by Net-SNMP use autoconf - the
> exception is Win32 + MSVC. For this platform there was the choice
> between either introducing a typedef or duplicating the size check.

I am aware of that but then I think the typedef should be placed in
win32/net-snmp-config.h. Doesn't that file exist to place win32 specific
things in it?

At the very least it is MSVC that should be treated specially and not
GCC, why do you have an

#if defined(__GNUC__)

to handle windows oddities?

> Regarding including <inttypes.h>: please also keep in mind that the
> header <net-snmp/library/tools.h> is already used in some configure
> tests before net-snmp-config.h has been generated.

Which ones? Remember that all the defines are added incrementally while
configure runs so it is just an issue of making sure that the tests are
done in the right order.

>  Which means: before configure had a chance to define macros like
> HAVE_INTTYPES_H.
> 
> Regarding Solaris 10 + Sun C 5.7: specifying "breaks builds" without
> any further information is not very helpful.

Sorry.

"../../net-snmp/include/net-snmp/library/tools.h", line 83: zero-sized
struct/union

>  While ANSI C allows to leave out the variable name when declaring a
> bitfield, maybe the Sun C 5.7 compiler doesn't support this. Does
> changing "int:-!" into "int dummy:-!" help ?

No.

"../../net-snmp/include/net-snmp/library/tools.h", line 83: zero sized
bit-field
"../../net-snmp/include/net-snmp/library/tools.h", line 83: zero-sized
struct/union

Oh, by the way, you introduce a pedwarning in gcc as well.

include/net-snmp/library/tools.h:83:14: warning: struct has no named
members [-pedantic]

That one i think should be fixed by your suggested patch.

/MF

(BTW, the usual way to make a static assertion is

  struct foo { int bar[1 - 2 * (condition)]; };

but I still think this test is utterly wrong in the first place)


------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to