[cfe-commits] r140931 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td include/clang/Sema/AttributeList.h include/clang/Sema/Sema.h lib/Sema/SemaDeclAttr.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaType.cpp test/Parser/MicrosoftExtensions.c test/Sema/types.c

Jakob Stoklund Olesen stoklund at 2pi.dk
Mon Oct 3 08:40:16 PDT 2011


On Sep 30, 2011, at 10:17 PM, John McCall wrote:

> Author: rjmccall
> Date: Sat Oct  1 00:17:03 2011
> New Revision: 140931
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=140931&view=rev
> Log:
> Hey, maybe we shouldn't silently ignore decl attributes
> on declarators written as types.

Hi John,

This breaks attr-nest.c in the GCC test suite:

$ /d/b/Release+Asserts/bin/clang -o /dev/null gcc-4_2-testsuite/src/gcc.dg/attr-nest.c
gcc-4_2-testsuite/src/gcc.dg/attr-nest.c:11:19: error: 'format' attribute ignored when parsing type
  bar (0, (void (*ATTR_PRINTF) (const char *, ...)) 0);
                  ^~~~~~~~~~~
gcc-4_2-testsuite/src/gcc.dg/attr-nest.c:3:37: note: expanded from:
#define ATTR_PRINTF __attribute__ ((format (printf, 1, 2)))
                                    ^~~~~~~~~~~~~~~~~~~~~

And this one:

$ /d/b/Release+Asserts/bin/clang -o /dev/null gcc-4_2-testsuite/src/gcc.dg/20011214-1.c
gcc-4_2-testsuite/src/gcc.dg/20011214-1.c:11:8: error: 'mode' attribute ignored when parsing type
  x = (small) y;                                /* { dg-bogus "ignored" } */
       ^~~~~
gcc-4_2-testsuite/src/gcc.dg/20011214-1.c:6:32: note: expanded from:
#define small   __attribute__((mode(QI))) int
                               ^~~~~~~~
gcc-4_2-testsuite/src/gcc.dg/20011214-1.c:12:15: error: 'mode' attribute ignored when parsing type
  if (sizeof (small) != sizeof (char))          /* { dg-bogus "ignored" } */
              ^~~~~
gcc-4_2-testsuite/src/gcc.dg/20011214-1.c:6:32: note: expanded from:
#define small   __attribute__((mode(QI))) int
                               ^~~~~~~~
2 errors generated.


And this one:

$ /d/b/Release+Asserts/bin/clang -o /dev/null gcc-4_2-testsuite/src/g++.dg/ext/attrib3.C
gcc-4_2-testsuite/src/g++.dg/ext/attrib3.C:15:16: error: 'mode' attribute ignored when parsing type
          || sizeof ((attrib signed int) b) != 1);
                      ^~~~~~
gcc-4_2-testsuite/src/g++.dg/ext/attrib3.C:5:30: note: expanded from:
#define attrib __attribute ((mode (QI)))
                             ^~~~~~~~~
1 error generated.


Please fix the test suite if these errors are legit.

Thanks,
/jakob




More information about the cfe-commits mailing list