re: iphlpapi: Don't rely on the HAVE_XXX macros having a numeric values.
-#elif defined(HAVE_SYS_SYSCTL_H) && defined(IPCTL_STATS) && (HAVE_STRUCT_IPSTAT_IPS_TOTAL || HAVE_STRUCT_IP_STATS_IPS_TOTAL) +#elif defined(HAVE_SYS_SYSCTL_H) && defined(IPCTL_STATS) && (defined(HAVE_STRUCT_IPSTAT_IPS_TOTAL) || defined(HAVE_STRUCT_IP_STATS_IPS_TOTAL)) Isn't this a no-op? I thought that an undefined symbol was treated as false by the preprocessor. When I compile #if defined(HAVE_SYS_SYSCTL_H) && defined(IPCTL_STATS) && (HAVE_STRUCT_IPSTAT_IPS_TOTAL || HAVE_STRUCT_IP_STATS_IPS_TOTAL) defined #else not defined #endif with gcc -E or cl /E, I get not defined
On Fri, 8 Jun 2012, Dan Kegel wrote:
-#elif defined(HAVE_SYS_SYSCTL_H) && defined(IPCTL_STATS) && (HAVE_STRUCT_IPSTAT_IPS_TOTAL || HAVE_STRUCT_IP_STATS_IPS_TOTAL) +#elif defined(HAVE_SYS_SYSCTL_H) && defined(IPCTL_STATS) && (defined(HAVE_STRUCT_IPSTAT_IPS_TOTAL) || defined(HAVE_STRUCT_IP_STATS_IPS_TOTAL))
Isn't this a no-op? I thought that an undefined symbol was treated as false by the preprocessor.
Actually you may be right. But then this is the only place in Wine where we rely on this and I see not reason to make this assumption. Even more so since we don't for the other macros in the same test which makes this locally inconsistent. -- Francois Gouget <fgouget(a)free.fr> http://fgouget.free.fr/ Hiroshima '45 - Czernobyl '86 - Windows '95
On Fri, Jun 8, 2012 at 11:51 AM, Francois Gouget <fgouget(a)free.fr> wrote:
On Fri, 8 Jun 2012, Dan Kegel wrote:
Isn't this a no-op? I thought that an undefined symbol was treated as false by the preprocessor.
Actually you may be right. But then this is the only place in Wine where we rely on this and I see not reason to make this assumption. Even more so since we don't for the other macros in the same test which makes this locally inconsistent.
It feels funny to avoid using a basic feature of C... maybe we should remove the extra defined() calls.
Dan Kegel <dank(a)kegel.com> writes:
On Fri, Jun 8, 2012 at 11:51 AM, Francois Gouget <fgouget(a)free.fr> wrote:
On Fri, 8 Jun 2012, Dan Kegel wrote:
Isn't this a no-op? I thought that an undefined symbol was treated as false by the preprocessor.
Actually you may be right. But then this is the only place in Wine where we rely on this and I see not reason to make this assumption. Even more so since we don't for the other macros in the same test which makes this locally inconsistent.
It feels funny to avoid using a basic feature of C... maybe we should remove the extra defined() calls.
It's common practice to avoid it, to make things like -Wundef more useful. -- Alexandre Julliard julliard(a)winehq.org
Alexandre wrote:
It's common practice to avoid it, to make things like -Wundef more useful.
Good point. Reading http://ozlabs.org/~rusty/index.cgi/tech/2008-01-04.html makes me sad. -Wundef would be a lot more useful if autoconf defined symbols to zero instead of undefining them; then we could get rid of all the defined() calls, and the compiler could tell us when we'd misspelled a HAVE_XXX. Oh, well. - Dan
participants (3)
-
Alexandre Julliard -
Dan Kegel -
Francois Gouget