diff options
author | Greg Noel <GregNoel@tigris.org> | 2009-05-14 06:35:37 (GMT) |
---|---|---|
committer | Greg Noel <GregNoel@tigris.org> | 2009-05-14 06:35:37 (GMT) |
commit | 2d548244bc07ab8faf2c9c1196958007c98ad4bf (patch) | |
tree | c7b02dc1d62846598a40fa1ec063fcaaeaca3cda /src/engine/SCons | |
parent | d22a7fa3729cb3b97554eba01dd176b297ac1a99 (diff) | |
download | SCons-2d548244bc07ab8faf2c9c1196958007c98ad4bf.zip SCons-2d548244bc07ab8faf2c9c1196958007c98ad4bf.tar.gz SCons-2d548244bc07ab8faf2c9c1196958007c98ad4bf.tar.bz2 |
Issue 2410: Fix crash when using one-character identifiers in C and C++ macros.
Diffstat (limited to 'src/engine/SCons')
-rw-r--r-- | src/engine/SCons/cpp.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/cppTests.py | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/engine/SCons/cpp.py b/src/engine/SCons/cpp.py index a160164..47d664c 100644 --- a/src/engine/SCons/cpp.py +++ b/src/engine/SCons/cpp.py @@ -66,10 +66,10 @@ cpp_lines_dict = { # 2) The optional parentheses and arguments (if it's a function-like # macro, '' if it's not). # 3) The expansion value. - ('define',) : '\s+([_A-Za-z][_A-Za-z0-9_]+)(\([^)]*\))?\s*(.*)', + ('define',) : '\s+([_A-Za-z][_A-Za-z0-9_]*)(\([^)]*\))?\s*(.*)', # Fetch the #undefed keyword from a #undef line. - ('undef',) : '\s+([_A-Za-z][A-Za-z0-9_]+)', + ('undef',) : '\s+([_A-Za-z][A-Za-z0-9_]*)', } # Create a table that maps each individual C preprocessor directive to diff --git a/src/engine/SCons/cppTests.py b/src/engine/SCons/cppTests.py index 1c83a13..252a064 100644 --- a/src/engine/SCons/cppTests.py +++ b/src/engine/SCons/cppTests.py @@ -300,6 +300,10 @@ macro_function_input = """ /* Make sure we don't die if the expansion isn't a string. */ #define FUNC_INTEGER(x) 1 + +/* Make sure one-character names are recognized. */ +#define _(x) translate(x) +#undef _ """ |