summaryrefslogtreecommitdiff
path: root/libcpp/macro.c
diff options
context:
space:
mode:
authoraaw <aaw@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-24 20:55:36 +0000
committeraaw <aaw@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-24 20:55:36 +0000
commitce079f700daa3663cfaeb8286f84ad54edee6733 (patch)
tree39f5da17b3f4b0f1ab1e9e7b4922fef43daed126 /libcpp/macro.c
parenta78b652c30ccccb155dc1d9d644e8f42a53d6d19 (diff)
downloadgcc-ce079f700daa3663cfaeb8286f84ad54edee6733.tar.gz
* macro.c (_cpp_builtin_macro_text): Handle BT_COUNTER.
* pch.c (cpp_write_pch_deps): Save __COUNTER__ state. (cpp_write_pch_state): Save __COUNTER__ state. (cpp_valid_state): Check valid __COUNTER__ state. (cpp_read_state): Read new __COUNTER__ state. * include/cpplib.h (enum builtin_type): Add BT_COUNTER enumerator. * init.c (builtin_array): Add __COUNTER__/BT_COUNTER. * internal.h (struct cpp_reader): Add counter member. * gcc.dg/cpp/counter-1.c: New test. * gcc.dg/pch/counter-1.c: New test. * gcc.dg/pch/counter-1.hs: New file. * gcc.dg/pch/counter-2.c: New test. * gcc.dg/pch/counter-2.hs: New file. * gcc.dg/pch/counter-3.c: New test. * gcc.dg/pch/counter-3.hs: New file. * doc/cpp.texi (Common Predefined Macros): Add __COUNTER__ description. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125041 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp/macro.c')
-rw-r--r--libcpp/macro.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libcpp/macro.c b/libcpp/macro.c
index 12681c34338..c8d099ed210 100644
--- a/libcpp/macro.c
+++ b/libcpp/macro.c
@@ -263,6 +263,10 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node)
else
result = pfile->time;
break;
+
+ case BT_COUNTER:
+ number = pfile->counter++;
+ break;
}
if (result == NULL)