<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Different __LINE__ for different lines during macro expansion"
href="https://llvm.org/bugs/show_bug.cgi?id=22973">22973</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Different __LINE__ for different lines during macro expansion
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>a3at.mail@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
5447bd5deba61e1d4a647542c066e0a14e3ec5d7) (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
1f229009ed1bac72844587d24d031929175330dd)
Target: x86_64-unknown-linux-gnu
Thread model: posix
12
13</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>