llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.81k stars 11.91k forks source link

In -Eonly mode, pragmas are not correctly recognized #9909

Closed jsonn closed 10 years ago

jsonn commented 13 years ago
Bugzilla Link 9537
Resolution FIXED
Resolved on Dec 04, 2013 04:22
Version trunk
OS Linux
CC @llunak

Extended Description

Create a file containing only:

_Pragma("GCC visibility push(default)")

and compile with "clang -MM test.c -Wall". Observe warnings about unknown pragma.

llunak commented 10 years ago

r196372

llvmbot commented 12 years ago

For the reference, gcc 4.7.0 gives no warnings:

gcc -Wall -M a.h a.o: a.h

llvmbot commented 12 years ago

TO REPRODUCE:

cat << EOF > test.h

pragma GCC visibility push(default)

pragma GCC visibility pop

EOF

clang -Wall -M a.h

ACTUAL RESULT:

a.h:1:13: warning: unknown pragma ignored [-Wunknown-pragmas]

pragma GCC visibility push(default)

        ^

a.h:2:13: warning: unknown pragma ignored [-Wunknown-pragmas]

pragma GCC visibility pop

        ^

a.o: a.h 2 warnings generated.

EXPECTED RESULT:

No warnings

llvmbot commented 12 years ago

Have the same problem when using -M flag to generate dependencies:

$ clang -I. -I../include -Wall -fno-strict-aliasing -Wstrict-prototypes -Werror -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -g -O0 -DDEBUG -I/usr/include/libxml2 -fPIC -fvisibility=hidden -M uuid.c delta_read.c delta_sysfs.c balloon_util.c fsck_util.c ploop.c xml.c logger.c balloon.c lock.c fsutils.c gpt.c crc32.c merge.c util.c pcopy.c di.c cleanup.c > .depend In file included from uuid.c:28: In file included from ./ploop.h:11: ../include/libploop.h:21:13: error: unknown pragma ignored [-Werror,-Wunknown-pragmas]

pragma GCC visibility push(default)

        ^

../include/libploop.h:238:13: error: unknown pragma ignored [-Werror,-Wunknown-pragmas]

pragma GCC visibility pop

        ^

2 errors generated.

$ clang --version clang version 3.0 (tags/RELEASE_30/final) Target: x86_64-redhat-linux-gnu Thread model: posix