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: unassignedclangb...@nondot.org
          Reporter: andrey.kules...@intel.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to