[llvm-bugs] [Bug 26831] New: [ms] macro __FUNCTION__ cannot be used with "comment" and "message" pragmas

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 3 08:31:29 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26831

            Bug ID: 26831
           Summary: [ms] macro __FUNCTION__ cannot be used with "comment"
                    and "message" pragmas
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: andrey.kuleshov at intel.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

!- 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==================
>>>clang: 
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__)

>>>MSVC/intel icc compiler: 
func
function = func
function = WHY_NOTfunc

/EXPORT:func=?func@@YAXXZ


Andrey Kuleshov
======
Software Engineer
Intel Compiler Team

-- 
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/20160303/ec9f9074/attachment-0001.html>


More information about the llvm-bugs mailing list