This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug preprocessor/69473] system identification macros not documented
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 25 Jan 2016 22:33:36 +0000
- Subject: [Bug preprocessor/69473] system identification macros not documented
- Auto-submitted: auto-generated
- References: <bug-69473-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69473
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
The purpose of macros like __linux__ or __linux is to enable users to write
code that's portable to different versions or distributions of the same OS
without necessarily testing it on them all, or even having access to them.
The problem with relying on the output of the compiler (or cpp) is that, as bug
28314 points out, it sometimes differs between different compiler options or
even target architectures.
Since GCC encodes the conditions under which the macros are defined it needs to
document them. This could be done in a way that's similar to the Host/Target
specific installation notes for GCC
(https://gcc.gnu.org/install/specific.html), except with one entry per system.