summaryrefslogtreecommitdiff
path: root/support/cpp/libcpp
diff options
context:
space:
mode:
authorbenshi <benshi@4a8a32a2-be11-0410-ad9d-d568d2c75423>2015-04-29 04:57:50 +0000
committerbenshi <benshi@4a8a32a2-be11-0410-ad9d-d568d2c75423>2015-04-29 04:57:50 +0000
commita87e5aea4cb3da3bbc711d4fbdb6e7332f1f58d7 (patch)
tree5f8197be099556557c3d849046313b71a6892b50 /support/cpp/libcpp
parent89377d05d0895bbfefbd1d19991cde9d1b03747e (diff)
Fix bug #1952.
git-svn-id: https://svn.code.sourceforge.net/p/sdcc/code/trunk/sdcc@9224 4a8a32a2-be11-0410-ad9d-d568d2c75423
Diffstat (limited to 'support/cpp/libcpp')
-rw-r--r--support/cpp/libcpp/include/cpplib.h5
-rw-r--r--support/cpp/libcpp/init.c1
-rw-r--r--support/cpp/libcpp/macro.c10
3 files changed, 14 insertions, 2 deletions
diff --git a/support/cpp/libcpp/include/cpplib.h b/support/cpp/libcpp/include/cpplib.h
index 8685ef533..4e14afddc 100644
--- a/support/cpp/libcpp/include/cpplib.h
+++ b/support/cpp/libcpp/include/cpplib.h
@@ -625,8 +625,9 @@ enum cpp_builtin_type
BT_STDC, /* `__STDC__' */
BT_PRAGMA, /* `_Pragma' operator */
BT_TIMESTAMP, /* `__TIMESTAMP__' */
- BT_COUNTER, /* `__COUNTER__' */
- BT_FIRST_USER, /* User defined builtin macros. */
+ BT_COUNTER, /* `__COUNTER__' */
+ BT_FUNCTION, /* `__func__' */
+ BT_FIRST_USER, /* User defined builtin macros. */
BT_LAST_USER = BT_FIRST_USER + 31
};
diff --git a/support/cpp/libcpp/init.c b/support/cpp/libcpp/init.c
index 450244677..7960513c4 100644
--- a/support/cpp/libcpp/init.c
+++ b/support/cpp/libcpp/init.c
@@ -349,6 +349,7 @@ static const struct builtin_macro builtin_array[] =
B("__TIME__", BT_TIME, false),
B("__DATE__", BT_DATE, false),
B("__FILE__", BT_FILE, false),
+ B("__func__", BT_FUNCTION, false),
B("__BASE_FILE__", BT_BASE_FILE, false),
B("__LINE__", BT_SPECLINE, true),
B("__INCLUDE_LEVEL__", BT_INCLUDE_LEVEL, true),
diff --git a/support/cpp/libcpp/macro.c b/support/cpp/libcpp/macro.c
index 433a30a02..12d47e8e8 100644
--- a/support/cpp/libcpp/macro.c
+++ b/support/cpp/libcpp/macro.c
@@ -165,6 +165,16 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node)
result = pbuffer->timestamp;
}
break;
+ case BT_FUNCTION:
+ {
+ uchar *buf;
+ buf = _cpp_unaligned_alloc (pfile, 256);
+ memset (buf, 255, 256);
+ buf[0] = buf[254] = '"';
+ buf[255] = 0;
+ result = buf;
+ }
+ break;
case BT_FILE:
case BT_BASE_FILE:
{