svn commit: r201793 - head/sys/net80211

Bruce Evans brde at optusnet.com.au
Fri Jan 8 20:33:55 UTC 2010


On Fri, 8 Jan 2010, Edward Tomasz Napierala wrote:

> Log:
>  Fix #ifdefs so that GCC 4.4 doesn't complain about it.
>
>  Reviewed by:	rpaulo
>
> Modified:
>  head/sys/net80211/ieee80211_var.h
>
> Modified: head/sys/net80211/ieee80211_var.h
> ==============================================================================
> --- head/sys/net80211/ieee80211_var.h	Fri Jan  8 15:28:22 2010	(r201792)
> +++ head/sys/net80211/ieee80211_var.h	Fri Jan  8 15:41:24 2010	(r201793)
> @@ -32,11 +32,11 @@
>  * Definitions for IEEE 802.11 drivers.
>  */
> /* NB: portability glue must go first */
> -#ifdef __NetBSD__
> +#if defined(__NetBSD__)

"#if defined()" instead of "#ifdef" is a style bug.

> #include <net80211/ieee80211_netbsd.h>
> -#elif __FreeBSD__
> +#elif defined(__FreeBSD__)

"defined()" is unfortunately needed with #elif (or if multple #ifdefs
in a single statement are needed).

> #include <net80211/ieee80211_freebsd.h>
> -#elif __linux__
> +#elif defined(__linux__)
> #include <net80211/ieee80211_linux.h>
> #else
> #error	"No support for your operating system!"
>

It is a compiler bug to complain about undefined identifiers in cpp
expressions, or a user bug to configure the compiler to have this bug.
It is a standard C feature (6.10 [#3] in C99) that undefined identifiers
are replaced by 0 in preprocessor expressions.  This feature is very
useful for avoiding ugliness like the above defined()'s.

Bruce


More information about the svn-src-head mailing list