aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@gcc.gnu.org>2006-01-23 22:50:15 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2006-01-23 22:50:15 +0100
commit839009978ae5e2e4f30057e2cdfd925a05c9cc95 (patch)
tree426b4cdfa24c0b381ad5f2bef8e8807afd097204 /libcpp
parent7ebaeab50e26463a6fbe6fe23cffdf69a84bce30 (diff)
downloadgcc-839009978ae5e2e4f30057e2cdfd925a05c9cc95.zip
gcc-839009978ae5e2e4f30057e2cdfd925a05c9cc95.tar.gz
gcc-839009978ae5e2e4f30057e2cdfd925a05c9cc95.tar.bz2
re PR preprocessor/25717 (-dD does not list all defined macros (in particular, __STDC__))
PR preprocessor/25717 * init.c (cpp_init_builtins): If __STDC__ will not change value between system headers and other sources, define it as a normal macro rather than a builtin. * macro.c (_cpp_builtin_macro_text) <case BT_STDC>: Only check cpp_in_system_header condition. From-SVN: r110144
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog11
-rw-r--r--libcpp/init.c8
-rw-r--r--libcpp/macro.c14
3 files changed, 22 insertions, 11 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index b4fae0d..3a4885f 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,4 +1,13 @@
-2006-02-05 Paolo Bonzini <bonzini@gnu.org>
+2006-01-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR preprocessor/25717
+ * init.c (cpp_init_builtins): If __STDC__ will not change value
+ between system headers and other sources, define it as a normal
+ macro rather than a builtin.
+ * macro.c (_cpp_builtin_macro_text) <case BT_STDC>: Only check
+ cpp_in_system_header condition.
+
+2006-01-05 Paolo Bonzini <bonzini@gnu.org>
* Makefile.in: Use -MMD instead of -MD.
diff --git a/libcpp/init.c b/libcpp/init.c
index bbf2705..bf4c34c 100644
--- a/libcpp/init.c
+++ b/libcpp/init.c
@@ -357,8 +357,14 @@ cpp_init_builtins (cpp_reader *pfile, int hosted)
if (CPP_OPTION (pfile, traditional))
n -= 2;
+ else if (! CPP_OPTION (pfile, stdc_0_in_system_headers)
+ || CPP_OPTION (pfile, std))
+ {
+ n--;
+ _cpp_define_builtin (pfile, "__STDC__ 1");
+ }
- for(b = builtin_array; b < builtin_array + n; b++)
+ for (b = builtin_array; b < builtin_array + n; b++)
{
cpp_hashnode *hp = cpp_lookup (pfile, b->name, b->len);
hp->type = NT_MACRO;
diff --git a/libcpp/macro.c b/libcpp/macro.c
index 2f1a974..3204e55 100644
--- a/libcpp/macro.c
+++ b/libcpp/macro.c
@@ -169,16 +169,12 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node)
However, if (a) we are in a system header, (b) the option
stdc_0_in_system_headers is true (set by target config), and
(c) we are not in strictly conforming mode, then it has the
- value 0. */
+ value 0. (b) and (c) are already checked in cpp_init_builtins. */
case BT_STDC:
- {
- if (cpp_in_system_header (pfile)
- && CPP_OPTION (pfile, stdc_0_in_system_headers)
- && !CPP_OPTION (pfile,std))
- number = 0;
- else
- number = 1;
- }
+ if (cpp_in_system_header (pfile))
+ number = 0;
+ else
+ number = 1;
break;
case BT_DATE: