diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-18 06:38:24 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-18 06:38:24 +0000 |
commit | 5ca5d40cf4092bc55781e32b92525c6b4ce4c446 (patch) | |
tree | 000790601c2b83a8d00a1536e409ccc07284a8e5 | |
parent | 652d82a096996d5ee7665b2905742e1a23364862 (diff) | |
download | bcm5719-llvm-5ca5d40cf4092bc55781e32b92525c6b4ce4c446.tar.gz bcm5719-llvm-5ca5d40cf4092bc55781e32b92525c6b4ce4c446.zip |
second half of PR3940: #line requires simple digit sequence.
llvm-svn: 69422
-rw-r--r-- | clang/include/clang/Basic/DiagnosticLexKinds.td | 2 | ||||
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 3 | ||||
-rw-r--r-- | clang/test/Preprocessor/line-directive.c | 3 |
3 files changed, 7 insertions, 1 deletions
diff --git a/clang/include/clang/Basic/DiagnosticLexKinds.td b/clang/include/clang/Basic/DiagnosticLexKinds.td index 17ff3f0683a..564608865e6 100644 --- a/clang/include/clang/Basic/DiagnosticLexKinds.td +++ b/clang/include/clang/Basic/DiagnosticLexKinds.td @@ -229,6 +229,8 @@ def err_pp_line_invalid_filename : Error< "invalid filename for #line directive">; def warn_pp_line_decimal : Warning< "#line directive requires decimal line number">; +def warn_pp_line_digit_sequence : Warning< + "#line directive requires a simple digit sequence">; def err_pp_linemarker_requires_integer : Error< "line marker directive requires a positive integer argument">; def err_pp_linemarker_invalid_filename : Error< diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index e4b36fd1573..3d312748f95 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -654,7 +654,8 @@ static bool GetLineValue(Token &DigitTok, unsigned &Val, // because it is octal. if (Literal.getRadix() != 10) PP.Diag(DigitTok, diag::warn_pp_line_decimal); - + else if (Literal.hasSuffix()) + PP.Diag(DigitTok, diag::warn_pp_line_digit_sequence); return false; } diff --git a/clang/test/Preprocessor/line-directive.c b/clang/test/Preprocessor/line-directive.c index 8877406adc2..98f92f130c6 100644 --- a/clang/test/Preprocessor/line-directive.c +++ b/clang/test/Preprocessor/line-directive.c @@ -70,3 +70,6 @@ typedef int w; // expected-error {{redefinition of typedef 'w' is invalid in C} // PR3940 #line 0xf // expected-warning {{#line directive requires decimal line number}} +#line 42U // expected-warning {{#line directive requires a simple digit sequence}} + + |