Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Jan 2010 07:33:51 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Edward Tomasz Napierala <trasz@FreeBSD.org>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: svn commit: r201793 - head/sys/net80211
Message-ID:  <20100109071832.H57772@delplex.bde.org>
In-Reply-To: <201001081541.o08FfOHb014564@svn.freebsd.org>
References:  <201001081541.o08FfOHb014564@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100109071832.H57772>