[LLVMbugs] [Bug 22973] New: Different __LINE__ for different lines during macro expansion
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat Mar 21 05:38:13 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=22973
Bug ID: 22973
Summary: Different __LINE__ for different lines during macro
expansion
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: a3at.mail at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Using the following simple example you can see that gcc shows 13:13, while
clang 12:13.
Is clang behavior correct?
Thanks!
$ cat test.c
#include <stdio.h>
#define stringify(x) #x
#define tostring(x) stringify(x)
#define outer(a, b) { a; b; }
#define inner() { puts(tostring(__LINE__)); }
int main()
{
outer(
inner()
, inner());
return 0;
}
$ gcc --version; gcc test.c && ./a.out
gcc (Debian 4.9.2-10) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
13
$ clang --version; clang /tmp/test.c && ./a.out
clang version 3.7.0 (http://llvm.org/git/clang.git
5447bd5deba61e1d4a647542c066e0a14e3ec5d7) (http://llvm.org/git/llvm.git
1f229009ed1bac72844587d24d031929175330dd)
Target: x86_64-unknown-linux-gnu
Thread model: posix
12
13
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150321/6d096ec8/attachment.html>
More information about the llvm-bugs
mailing list