<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 --- - [ms] macro __FUNCTION__ cannot be used with "comment" and "message" pragmas"
href="https://llvm.org/bugs/show_bug.cgi?id=26831">26831</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[ms] macro __FUNCTION__ cannot be used with "comment" and "message" pragmas
</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>Windows NT
</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>andrey.kuleshov@intel.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>!- clang does not recognize macros __FUNCTION__ and __FUNCDNAME__ in #pragma
message and #pragma comment. Ms cl compiler works without errors and prints
function name in this case -!
===========ENVIRONMENT==================
OS: Windows
Language: c/c++
Version: trunk
===========SMALL REPRODUCER=============
void func(void) {
#pragma message(__FUNCTION__)
#pragma message("function = " __FUNCTION__)
#pragma message("function = " "WHY_NOT" __FUNCTION__ "\n")
#pragma comment(linker, "/EXPORT:" __FUNCTION__ "=" __FUNCDNAME__)
#pragma message("/EXPORT:" __FUNCTION__ "=" __FUNCDNAME__)
}
============DIAGNOSTICS==================
<span class="quote">>>>clang: </span >
test.cpp:2:19: error: expected string literal in pragma message
#pragma message(__FUNCTION__)
test.cpp:3:33: error: pragma message requires parenthesized string
#pragma message("function = " __FUNCTION__)
test.cpp:4:43: error: pragma message requires parenthesized string
#pragma message("function = " "WHY_NOT" __FUNCTION__ "\n")
test.cpp:5:38: error: pragma comment requires parenthesized identifier and
optional string
#pragma comment(linker, "/EXPORT:" __FUNCTION__ "=" __FUNCDNAME__)
test.cpp:6:30: error: pragma message requires parenthesized string
#pragma message("/EXPORT:" __FUNCTION__ "=" __FUNCDNAME__)
<span class="quote">>>>MSVC/intel icc compiler: </span >
func
function = func
function = WHY_NOTfunc
/EXPORT:func=?func@@YAXXZ
Andrey Kuleshov
======
Software Engineer
Intel Compiler Team</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>