[LLVMbugs] [Bug 20948] New: #pragma weak "forward declaration" doesn't always work

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Sep 15 10:56:24 PDT 2014


            Bug ID: 20948
           Summary: #pragma weak "forward declaration" doesn't always work
           Product: clang
           Version: 3.4
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: markj at FreeBSD.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13043
  --> http://llvm.org/bugs/attachment.cgi?id=13043&action=edit
Test case

#pragma weak _foo = foo

can be used before foo is declared, provided that foo is defined as non-static.
However, if foo is static, clang emits a warning and no weak symbol is

  $ clang -c -o forward.o forward.c
  forward.c:1:14: warning: weak identifier 'foo' never declared
  #pragma weak _foo = foo
  1 warning generated.

gcc 4.7 appears to generate the expected result in both cases.

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/20140915/fc577426/attachment.html>

More information about the llvm-bugs mailing list