Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/matt-nb6-plus]: src/gnu/dist/gcc4/libcpp Pull from HEAD:
details: https://anonhg.NetBSD.org/src/rev/05563edaf7d6
branches: matt-nb6-plus
changeset: 774503:05563edaf7d6
user: matt <matt%NetBSD.org@localhost>
date: Tue Nov 27 22:18:49 2012 +0000
description:
Pull from HEAD:
Teach gcc4.1's cpp about the magic __COUNTER__ macro,
which returns a unique integer each time it is expanded.
This code was written without reference to any other
implementation of the same feature.
diffstat:
gnu/dist/gcc4/libcpp/include/cpplib.h | 1 +
gnu/dist/gcc4/libcpp/init.c | 1 +
gnu/dist/gcc4/libcpp/macro.c | 8 ++++++++
3 files changed, 10 insertions(+), 0 deletions(-)
diffs (40 lines):
diff -r b1636a019e67 -r 05563edaf7d6 gnu/dist/gcc4/libcpp/include/cpplib.h
--- a/gnu/dist/gcc4/libcpp/include/cpplib.h Wed Nov 21 08:54:21 2012 +0000
+++ b/gnu/dist/gcc4/libcpp/include/cpplib.h Tue Nov 27 22:18:49 2012 +0000
@@ -551,6 +551,7 @@
BT_BASE_FILE, /* `__BASE_FILE__' */
BT_INCLUDE_LEVEL, /* `__INCLUDE_LEVEL__' */
BT_TIME, /* `__TIME__' */
+ BT_COUNTER, /* `__COUNTER__' */
BT_STDC, /* `__STDC__' */
BT_PRAGMA /* `_Pragma' operator */
};
diff -r b1636a019e67 -r 05563edaf7d6 gnu/dist/gcc4/libcpp/init.c
--- a/gnu/dist/gcc4/libcpp/init.c Wed Nov 21 08:54:21 2012 +0000
+++ b/gnu/dist/gcc4/libcpp/init.c Tue Nov 27 22:18:49 2012 +0000
@@ -309,6 +309,7 @@
B("__BASE_FILE__", BT_BASE_FILE),
B("__LINE__", BT_SPECLINE),
B("__INCLUDE_LEVEL__", BT_INCLUDE_LEVEL),
+ B("__COUNTER__", BT_COUNTER),
/* Keep builtins not used for -traditional-cpp at the end, and
update init_builtins() if any more are added. */
B("_Pragma", BT_PRAGMA),
diff -r b1636a019e67 -r 05563edaf7d6 gnu/dist/gcc4/libcpp/macro.c
--- a/gnu/dist/gcc4/libcpp/macro.c Wed Nov 21 08:54:21 2012 +0000
+++ b/gnu/dist/gcc4/libcpp/macro.c Tue Nov 27 22:18:49 2012 +0000
@@ -284,6 +284,14 @@
else
result = pfile->time;
break;
+
+ case BT_COUNTER:
+ {
+ static unsigned int counter = 0;
+
+ number = counter++;
+ }
+ break;
}
if (result == NULL)
Home |
Main Index |
Thread Index |
Old Index