Граф коммитов

78 Коммитов

Автор SHA1 Сообщение Дата
Nick Lewycky de72f10593 Add missing InGroup for this warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173429 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25 07:31:12 +00:00
Nick Lewycky bcac91aafc Give warn_redecl_library_builtin a flag name: -Wincompatible-library-redeclaration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173319 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-24 03:43:15 +00:00
Richard Smith 5b9268f26a Fix code that attempted to produce a diagnostic with one DiagnosticEngine, then
produce a note for that diagnostic either with a different DiagnosticEngine or
after calling DiagnosticEngine::Reset(). That didn't make any sense, and did the
wrong thing if the original diagnostic was suppressed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170636 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-20 02:22:15 +00:00
Ted Kremenek 8fcdea5cc4 Add -Wmismatched-return-types flag for existing warning on conflicting return types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167518 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-07 01:43:44 +00:00
Ted Kremenek eaa6b12031 Add -Wmismatched-parameter-types flag for existing warning on conflicting parameter types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167515 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-07 01:25:56 +00:00
Eli Friedman 19ebeb70c4 Add missing diagnostic group to format string warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167279 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-02 02:14:44 +00:00
Eli Friedman 80a8eb76a0 Tweak wording and add diagnostic groups to misc diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167274 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-02 01:40:23 +00:00
Rafael Espindola e6c3458723 Remove ccc-no-clang-cpp, which is also dead now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167062 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-30 23:49:11 +00:00
Rafael Espindola d2d4d68a58 In the past "production" clang builds would not be used for c++, and
we had the -ccc-clang-cxx and -ccc-no-clang-cxx options to force them
on or off for testing.

Clang c++ support is now production quality and these options are dead.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166986 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-30 00:13:16 +00:00
Douglas Gregor 986819acbc Update warning-flag test
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166656 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-25 00:34:38 +00:00
Bill Wendling c6cd9afd15 Revert r166647 to rethink the patch...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166655 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-25 00:32:44 +00:00
Bill Wendling a0b9ce0388 Add some support for diagnosing possibly mismatched constraint, type size and
modifiers. (From an idea by Eric...)
<rdar://problem/12284092>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166647 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-25 00:05:55 +00:00
Fariborz Jahanian bea52dac0c Adds couple of missing warning flags so warnings can be turned
off. // rdar://12501960


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166150 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-17 23:19:22 +00:00
Rafael Espindola 238b6a9d33 The clang driver has a fairly fancy support for executing gcc instead of
clang itself. This dates back to clang's early days and while it looks like
some of it is still used (for kext for example), other parts are probably dead.

Remove the -ccc-clang-archs option and associated code. I don't think there
is any remaining setup where clang doesn't support an architecture but it can
expect an working gcc cross compiler to be available.

A nice side effect is that tests no longer need to differentiate architectures
that are included in production builds of clang and those that are not.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165545 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-09 20:46:28 +00:00
Eli Friedman 9595c7e253 Permanently end the whole "pragma got handled by the parser too early"
mess by handling all pragmas which the parser touches uniformly.
<rdar://problem/12248901>, etc.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165195 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-04 02:36:51 +00:00
Richard Smith 561e3c6886 PR13881: Add -Wzero-length-array for zero length array extension, and move it into -Wgnu.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164272 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-20 01:02:05 +00:00
Douglas Gregor 75379455fc Promote the warning about extra qualification on a declaration from a
warning to an error. C++ bans it, and both GCC and EDG diagnose it as
an error. Microsoft allows it, so we still warn in Microsoft
mode. Fixes <rdar://problem/11135644>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163831 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-13 20:16:20 +00:00
Aaron Ballman c828620a03 Splitting the duplicated decl spec extension warning into two: one is an ExtWarn and the other a vanilla warning. This addresses PR13705, where const char const * wouldn't warn unless -pedantic was specified under the right conditions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162793 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-28 20:55:40 +00:00
Ted Kremenek bb5185c0ca Fix horrible regression in control of warnings caused by introduction of -Wpedantic.
While -Wpedantic was reasonable, -Wno-pedantic would turn off a bunch of warnings that
are on by default.  This counters the intention of this warning flag.

To fix this, -Wpedantic now includes extentions that are not on by default.  The
remaining warnings will manifest anyway, and won't accidentally get turned off
by -Wno-pedantic.

Fixes <rdar://problem/12076105>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161695 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10 20:50:00 +00:00
Richard Smith 04c3a25bd4 PR13529: Don't crash if the driver sees an unused input file when running as
'clang-cpp'.

For now, the test uses "REQUIRES: shell" to determine if the host system
supports "ln -s", which it uses to create a 'clang-cpp' symlink. This is a bit
hacky and should likely be directly supported by lit.cfg.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161317 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-06 04:09:06 +00:00
Ted Kremenek c0a43777ef Promote warn_unknown_analyzer_checker to an error. Addresses <rdar://problem/10987863>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160706 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-25 07:12:13 +00:00
Richard Smith eab9d6f906 Add diagnostics for comma at end of enum and for extra semicolon at namespace
scope to -Wc++11-extensions. Move extra semicolon after member function
definition diagnostic out of -pedantic, since C++ allows a single semicolon
there. Keep it in -Wextra-semi, though, since it's still questionable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160618 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-23 05:45:25 +00:00
Tanya Lattner 916ea6522a Move a bunch of the attribute warnings under the IgnoreAttributes group. Cleaned up test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160190 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-13 20:45:35 +00:00
Tanya Lattner 002bb8f7ee TEMPORARY. I will fix this properly shortly.
Silence buildbot so I can figure out the right flag to put this warning under.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159967 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-09 23:01:07 +00:00
Ted Kremenek a437b84765 Enhance 'diagtool list-warnings' to report number of diagnostics covered directly under -Wpedantic, and enhance warning-flags.c test to test that this set does not grow.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159893 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-07 06:30:31 +00:00
Ted Kremenek e8cf7d1434 Re-apply r159875 with fixes.
- Split pedantic driver flag test into separate test file, and XFAIL on cygwin,mingw32
- Fix bug in tablegen logic where a missing '{' caused errors to be included in -Wpedantic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159892 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-07 05:53:30 +00:00
NAKAMURA Takumi 3b4c532596 Revert rr159875, "Implement -Wpedantic and --no-pedantic to complement -Weverything." It broke several builds.
I suspect FileCheck might match assertion failure, even if clang/test/Misc/warning-flags.c passed the test.

> 0. Program arguments: bin/./clang -### -pedantic -Wpedantic clang/test/Driver/warning-options.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159886 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-07 02:48:02 +00:00
Ted Kremenek 25570a94ca Implement -Wpedantic and --no-pedantic to complement -Weverything.
This patch introduces some magic in tablegen to create a "Pedantic" diagnostic
group which automagically includes all warnings that are extensions.  This
allows a user to suppress specific warnings traditionally under -pedantic used
an ordinary warning flag.  This also allows users to use #pragma to silence
specific -pedantic warnings, or promote them to errors, within blocks of text
(just like any other warning).

-Wpedantic is NOT an alias for -pedantic.  Instead, it provides another way
to (a) activate -pedantic warnings and (b) disable them.  Where they differ
is that -pedantic changes the behavior of the preprocessor slightly, whereas
-Wpedantic does not (it just turns on the warnings).

The magic in the tablegen diagnostic emitter has to do with computing the minimal
set of diagnostic groups and diagnostics that should go into -Wpedantic, as those
diagnostics that already members of groups that themselves are (transitively) members
of -Wpedantic do not need to be included in the Pedantic group directly.  I went
back and forth on whether or not to magically generate this group, and the invariant
was that we always wanted extension warnings to be included in -Wpedantic "some how",
but the bookkeeping would be very onerous to manage by hand.

-no-pedantic (and --no-pedantic) is included for completeness, and matches many of the
same kind of flags the compiler already supports.  It does what it says: cancels out
-pedantic.  One discrepancy is that if one specifies --no-pedantic and -Weverything or
-Wpedantic the pedantic warnings are still enabled (essentially the -W flags win).  We
can debate the correct behavior here.

Along the way, this patch nukes some code in TextDiagnosticPrinter.cpp and CXStoredDiagnostic.cpp
that determine whether to include the "-pedantic" flag in the warning output.  This is
no longer needed, as all extensions now have a -W flag.

This patch also significantly reduces the number of warnings not under flags from 229
to 158 (all extension warnings).  That's a 31% reduction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159875 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 23:07:31 +00:00
Matt Beaumont-Gay 5fe9b296fa Add a warning flag for "'extern' variable has an initializer".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159600 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-02 21:58:14 +00:00
Richard Smith b6ebd44902 Add warning flag -Winvalid-pp-token for preprocessing-tokens which have
undefined behaviour, and move the diagnostic for '' from an Error into
an ExtWarn in this group. This is important for some users of the preprocessor,
and is necessary for gcc compatibility.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159335 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-28 07:51:56 +00:00
Fariborz Jahanian de376286f1 objc: adds diagnostic group to several old objc warnings.
// rdar://11741435 pr13184



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159213 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-26 17:47:42 +00:00
Richard Smith 9f728cd374 Minor improvements to some C99 variadic-macro-related diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159054 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-22 23:59:08 +00:00
Jordan Rose 0764573a17 [diagtool] Write to llvm::outs() by default instead of llvm::errs()
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158954 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-22 00:33:20 +00:00
Jordan Rose d73ef135ba Add pedantic warning -Wempty-translation-unit (C11 6.9p1).
In standard C since C89, a 'translation-unit' is syntactically defined to have
at least one "external-declaration", which is either a decl or a function
definition. In Clang the latter gives us a declaration as well.

The tricky bit about this warning is that our predefines can contain external
declarations (__builtin_va_list and the 128-bit integer types). Therefore our
AST parser now makes sure we have at least one declaration that doesn't come
from the predefines buffer.

Also, remove bogus warning about empty source files. This doesn't catch source
files that only contain comments, and never fired anyway because of our
predefines.

PR12665 and <rdar://problem/9165548>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158085 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-06 17:25:21 +00:00
Richard Trieu 4b0e6f1da3 Move the warnings for extra semi-colons under -Wextra-semi. Also, added
a warning for an extra semi-colon after function definitions.  Added logic
so that a block of semi-colons on a line will only get one warning instead
of a warning for each semi-colon.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156934 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-16 19:04:59 +00:00
Rafael Espindola cab42cd24f Put the availability warnings in a group.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156261 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-06 16:49:20 +00:00
Ted Kremenek 08c88db935 Place several uncovered warnings under warning flags, and tweak diagnostic output including the term "gc" (in lowercase).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155892 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-01 05:56:02 +00:00
Douglas Gregor b46d30f6c9 Move warn_cxx0x_right_shift_in_template_arg to CXX11Compat group, from
Dmitri Gribenko!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155872 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-01 01:32:13 +00:00
Ted Kremenek 9ace587fe5 Add warning flag for '#import is a language extension', -W#import-pedantic.
Don't know if it is an anathema to include '#' in the warning name.  I'm fine
with changing it, but this was the most obvious name.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152886 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-16 01:03:40 +00:00
Nico Weber 7d613bf783 Move int<->pointer conversion warnings behind -Wint-conversions.
This is consistent with -Wbool-conversion. Let me know if you prefer
a different flag name.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151934 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 20:23:08 +00:00
James Molloy 16f1f717af Reapply r151638 and r151641.
The bug that was caught by Apple's internal buildbots was valid and also showed another bug in my implementation.

These are now fixed, with regression tests added to catch them both (not Darwin-specific).

Original log:
====================

Revert r151638 because it causes assertion hit on PCH creation for Cocoa.h

Original log:
---------------------
Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped.

This fixes code such as:

enum e {x, y};
int f(enum {y, x} n) {
 return 0;
}

This finally fixes PR5464 and PR5477.
---------------------

I also reverted r151641 which was enhancement on top of r151638.

====================




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151712 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 10:24:19 +00:00
Argyrios Kyrtzidis 32a9a7543f Revert r151638 because it causes assertion hit on PCH creation for Cocoa.h
Original log:
---------------------
Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped.

This fixes code such as:

enum e {x, y};
int f(enum {y, x} n) {
 return 0;
}

This finally fixes PR5464 and PR5477.
---------------------

I also reverted r151641 which was enhancement on top of r151638.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151667 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-28 23:39:14 +00:00
James Molloy fbcf0405b7 Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped.
This fixes code such as:

enum e {x, y};
int f(enum {y, x} n) {
  return 0;
}

This finally fixes PR5464 and PR5477.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151638 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-28 18:12:11 +00:00
Richard Smith 0f163e9642 Support GCC's bug^Wextension allowing class array members to be initalized by a
parenthesized braced-init-list in the base/member initialization list.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150625 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-15 22:38:09 +00:00
Dmitri Gribenko 684a8e471b Remove unused diagnostics from include/clang/Basic/Diagnostic*.td files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150409 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-13 20:13:24 +00:00
Richard Smith 244ee7b89a Pedantic diagnostic correction: in C++, we have integral constant expressions,
not integer constant expressions. In passing, fix the 'folding is an extension'
diagnostic to not claim we're accepting the code, since that's not true in
-pedantic-errors mode, and add this diagnostic to -Wgnu.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148209 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-15 03:51:30 +00:00
Richard Smith cb7709c060 PR10828: Produce a warning when a no-arguments function is declared in block
scope, when no other indication is provided that the user intended to declare a
function rather than a variable.

Remove some false positives from the existing 'parentheses disambiguated as a
function' warning by suppressing it when the declaration is marked as 'typedef'
or 'extern'.

Add a new warning group -Wvexing-parse containing both of these warnings.

The new warning is enabled by default; despite a number of false positives (and
one bug) in clang's test-suite, I have only found genuine bugs with it when
running it over a significant quantity of real C++ code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147599 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-05 04:12:21 +00:00
Richard Smith d7c56e1114 Change the diagnostics which said 'accepted as an extension' to instead say
'is an extension'. The former is inappropriate and confusing when building with
-Werror/-pedantic-errors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147357 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-29 21:57:33 +00:00
Roman Divacky d7f02c6c05 Let the KNR promotion warning be disabled.
Patch by Dimitry Andric!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146982 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-20 18:35:44 +00:00
Richard Smith 80d39bf55f Add a warning flag for ext_embedded_directive. gcc considers this undefined
behaviour to be an error, so it's useful to be able to make it an error in clang
too.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146755 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-16 20:58:01 +00:00