[Olsr-dev] changing 'linux' macro to __linux__ or __gnu_linux__

Hans-Christoph Steiner (spam-protected)
Wed Feb 1 20:56:27 CET 2012

One thing that I've learned in my own porting work is: it is generally
the least overall work to try to use the platform macros that are
automatically defined by the compiler.  Android's NDK only recently
added the __ANDROID__ macro, for example, and Android's gcc also defines
__linux__, but NOT __gnu_linux__.

Every GNU/Linux I've tried (which is mostly Debian and derivatives) has
a compiler that sets __linux__ and __gnu_linux__.  So I propose changing
olsrd's linux macro to be __linux__ when its kernel-related and
__gnu_linux__ when its OS related.  This will allow the code to
differentiate between GNU/Linux and Android/Linux (not GNU at all,
besides the compiler).

If people are amenable, I'll post a patch.  This isn't so much to fix a
specific issue now, but rather to prevent issues from arising in the future.


More information about the Olsr-dev mailing list