https://llvm.org/bugs/show_bug.cgi?id=23356
Bug ID: 23356
Summary: Wrong comment parsing with -std=c89
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
Created attachment 14257
--> https://llvm.org/bugs/attachment.cgi?id=14257&action=edit
Patch to fix C89 comment parsing
In general clang cannot parse line comments when they are not enabled,
otherwise valid code is seen as invalid. I've attached patch to fix that.
$ cat p.c
#define str_(x) #x
#define str(x) str_(x)
char *s = str(//);
$ clang-3.5 -std=c89 -c p.c
p.c:3:11: error: unterminated function-like macro invocation
char *s = str(//);
^
p.c:2:9: note: macro 'str' defined here
#define str(x) str_(x)
^
p.c:3:19: error: expected expression
char *s = str(//);
^
p.c:3:10: error: expected ';' after top level declarator
char *s = str(//);
^
;
3 errors generated.
$ gcc -std=c89 -c p.c
$
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs