summaryrefslogtreecommitdiffstats
path: root/src/cppvalue.cpp
diff options
context:
space:
mode:
authoralbert-github <albert.tests@gmail.com>2021-04-19 09:56:05 (GMT)
committeralbert-github <albert.tests@gmail.com>2021-04-19 09:56:05 (GMT)
commite12a17cfba22bb0f8f7a331bf38237ed09866ddd (patch)
treef8660e6d241087d08b4608c2edf6efa9e1043698 /src/cppvalue.cpp
parent98c67549bc3cd855873e0ef5eeab7c6410699d78 (diff)
downloadDoxygen-e12a17cfba22bb0f8f7a331bf38237ed09866ddd.zip
Doxygen-e12a17cfba22bb0f8f7a331bf38237ed09866ddd.tar.gz
Doxygen-e12a17cfba22bb0f8f7a331bf38237ed09866ddd.tar.bz2
Warning from preprocessor regarding binary literals
When having a line like: ``` #if (JITTERLISP_FIXNUM_TAG_BIN == 0) ``` with ``` #define JITTERLISP_FIXNUM_TAG_BIN 0b0000 ``` we get the warning: ``` warning: preprocessing issue while doing constant expression evaluation: syntax error: input=' ( 0b0000 == 0)' ``` The equivalent hexadecimal / octal / decimal versions are OK, the handling for the binary was missing. (Found by Fossies in the poke package).
Diffstat (limited to 'src/cppvalue.cpp')
-rw-r--r--src/cppvalue.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/cppvalue.cpp b/src/cppvalue.cpp
index 31f0ab5..b6e7f65 100644
--- a/src/cppvalue.cpp
+++ b/src/cppvalue.cpp
@@ -51,6 +51,16 @@ CPPValue parseHexadecimal(const std::string& token)
return CPPValue(val);
}
+CPPValue parseBinary(const std::string& token)
+{
+ long val = 0;
+ for (const char *p = token.c_str(); *p != 0; p++)
+ {
+ if (*p >= '0' && *p <= '1') val = val * 2 + *p - '0';
+ }
+ return CPPValue(val);
+}
+
CPPValue parseCharacter(const std::string& token) // does not work for '\n' and the alike
{
if (token[1]=='\\')