[cfe-commits] r65647 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.def lib/Sema/SemaType.cpp test/Parser/MicrosoftExtensions.c test/Parser/objc-forcollection-neg-2.m test/Parser/traditional_arg_scope.c test/Parser/typeof.c test/Sema/address_spaces.c test/Sema/block-literal.c test/Sema/implicit-int.c test/Sema/invalid-decl.c test/Sema/invalid-struct-init.c
Douglas Gregor
dgregor at apple.com
Fri Feb 27 14:04:18 PST 2009
On Feb 27, 2009, at 10:53 AM, Chris Lattner wrote:
> Author: lattner
> Date: Fri Feb 27 12:53:28 2009
> New Revision: 65647
>
> URL: http://llvm.org/viewvc/llvm-project?rev=65647&view=rev
> Log:
> upgrade various 'implicit int' warnings from an ext-warn to warning
> when not
> in C89 mode. This makes it enabled by default instead of only
> enabled with
> -pedantic. Clang defaults to c99 mode, so people will see this more
> often
> than with GCC, but they can always use -std=c89 if they really want
> c89.
>
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def
> cfe/trunk/lib/Sema/SemaType.cpp
> cfe/trunk/test/Parser/MicrosoftExtensions.c
> cfe/trunk/test/Parser/objc-forcollection-neg-2.m
> cfe/trunk/test/Parser/traditional_arg_scope.c
> cfe/trunk/test/Parser/typeof.c
> cfe/trunk/test/Sema/address_spaces.c
> cfe/trunk/test/Sema/block-literal.c
> cfe/trunk/test/Sema/implicit-int.c
> cfe/trunk/test/Sema/invalid-decl.c
> cfe/trunk/test/Sema/invalid-struct-init.c
>
> Modified: cfe/trunk/lib/Sema/SemaType.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=65647&r1=65646&r2=65647&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/Sema/SemaType.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaType.cpp Fri Feb 27 12:53:28 2009
> @@ -74,10 +74,10 @@
> // parser already though by it pretending to have seen an 'int'
> in this
> // case.
> if (getLangOptions().ImplicitInt) {
> - if ((DS.getParsedSpecifiers() &
> (DeclSpec::PQ_StorageClassSpecifier |
> - DeclSpec::PQ_TypeSpecifier |
> - DeclSpec::PQ_TypeQualifier))
> == 0)
> - Diag(DS.getSourceRange().getBegin(),
> diag::ext_missing_declspec);
> + // In C89 mode, we only warn if there is a completely missing
> declspec
> + // when one is not allowed.
> + if (DS.isEmpty())
> + Diag(DS.getSourceRange().getBegin(),
> diag::warn_missing_declspec);
> } else if (!DS.hasTypeSpecifier()) {
> // C99 and C++ require a type specifier. For example, C99
> 6.7.2p2 says:
> // "At least one type specifier shall be given in the
> declaration
> @@ -86,7 +86,7 @@
> // FIXME: Does Microsoft really have the implicit int
> extension in C++?
> unsigned DK = getLangOptions().CPlusPlus && !getLangOptions
> ().Microsoft?
> diag::err_missing_type_specifier
> - : diag::ext_missing_type_specifier;
> + : diag::warn_missing_type_specifier;
> Diag(DS.getSourceRange().getBegin(), DK);
> }
Code insertion hint?
- Doug
More information about the cfe-commits
mailing list