| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(PR44064)
Summary:
As noted in PR, we have a poor test coverage for this warning. I think macro support was just overlooked. GCC warns in these cases.
Clang missed a real bug in the code I am working with, GCC caught it.
Reviewers: aaron.ballman
Reviewed By: aaron.ballman
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70624
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Clang should not warn for:
> test.c:2:12: warning: indirection of non-volatile null pointer will be deleted,
> not trap [-Wnull-dereference]
> return *(int __attribute__((address_space(256))) *) 0;
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Solves PR42292.
Reviewers: aaron.ballman, rsmith
Reviewed By: aaron.ballman
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69664
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
https://gcc.gnu.org/onlinedocs/gcc/Typeof.html
Differences from the GCC extension:
* __auto_type is also permitted in C++ (but only in places where
it could appear in C), allowing its use in headers that might
be shared across C and C++, or used from C++98
* __auto_type can be combined with a declarator, as with C++ auto
(for instance, "__auto_type *p")
* multiple variables can be declared in a single __auto_type
declaration, with the C++ semantics (the deduced type must be
the same in each case)
This patch also adds a missing restriction on applying typeof to
a bit-field, which GCC has historically rejected in C (due to
lack of clarity as to whether the operand should be promoted).
The same restriction also applies to __auto_type in C (in both
GCC and Clang).
This also fixes PR25449.
Patch by Nicholas Allegra!
llvm-svn: 252690
|
|
|
|
|
|
|
| |
which evaluates to true. rdar://18716393.
Reviewed by Richard Trieu
llvm-svn: 222009
|
|
|
|
|
|
| |
comments.
llvm-svn: 221714
|
|
|
|
|
|
|
| |
That this is a c-only patch. c++ already has this warning.
This addresses rdar://18716393
llvm-svn: 221702
|
|
|
|
| |
llvm-svn: 177354
|
|
|
|
| |
llvm-svn: 167274
|
|
|
|
|
|
| |
the sole parameter name in the diagnostic in more cases. Patch by Terry Long!
llvm-svn: 156807
|
|
|
|
|
|
|
| |
which expects exactly one argument, include the name of the argument in
the diagnostic text. Patch by Terry Long!
llvm-svn: 156607
|
|
|
|
| |
llvm-svn: 137620
|
|
|
|
|
|
|
| |
the callee note diagnostic was not emitted in the case where
there were too few arguments.
llvm-svn: 136437
|
|
|
|
|
|
|
|
|
|
|
|
| |
return f() || -1;
where the user meant to write '|'.
This bootstraps without any additional warnings.
Patch by Richard Trieu.
llvm-svn: 132327
|
|
|
|
|
|
| |
Addresses rdar://9269271.
llvm-svn: 130207
|
|
|
|
|
|
| |
a note with a location for the function prototype.
llvm-svn: 128833
|
|
|
|
|
|
|
|
| |
AnalysisBasedWarnings::IssueWarnings() where block-level expressions that need
to be recorded in the Stmt*->CFGBlock* map were not always done so. Fixes <rdar://problem/9171946>.
llvm-svn: 128170
|
|
|
|
|
|
| |
can be used to prune branches. Fixes false null pointer dereference warning in PR 8183.
llvm-svn: 126305
|
|
|
|
|
|
| |
null pointer...' warning due to reachability analysis.
llvm-svn: 126294
|
|
|
|
|
|
| |
the type of the expression *after* array/function decay.
llvm-svn: 120895
|
|
|
|
|
|
| |
require them to have complete types.
llvm-svn: 116297
|
|
|
|
|
|
|
|
|
| |
when the RHS of the ||/&& is ever 0 or 1. This handles a variety of
creative idioms for "true" used in C programs and fixes many false
positives at the expense of a few false negatives. This fixes
rdar://8230351.
llvm-svn: 109314
|
|
|
|
|
|
|
| |
Don't warn about "logically bool" expressions on the RHS,
even if they fold to a constant.
llvm-svn: 108388
|
|
|
|
|
|
|
|
|
|
|
| |
t2.c:2:12: warning: use of logical && with constant operand; switch to bitwise &
or remove constant [-Wlogical-bitwise-confusion]
return x && 4;
^ ~
wording improvement suggestions are welcome.
llvm-svn: 108260
|
|
|
|
|
|
|
|
| |
people seem to write when they want a deterministic trap.
Suggest instead that they use a volatile pointer or
__builtin_trap.
llvm-svn: 107756
|
|
|
|
| |
llvm-svn: 101800
|
|
|
|
|
|
|
|
|
| |
'strcmp' is bad, and
we don't have enough information to tell them how to use 'strncmp'. Instead, change the
diagnostic to indicate they should use 'strncmp'.
llvm-svn: 100890
|
|
|
|
|
|
|
|
|
|
| |
unevaluated contexts, because they only matter for code that will
actually be evaluated at runtime.
As part of this, I had to extend PartialDiagnostic to support fix-it
hints.
llvm-svn: 93266
|
|
|
|
|
|
| |
not in an evaluated context. This removes some bogus warnings.
llvm-svn: 93258
|
|
|
|
| |
llvm-svn: 93256
|
|
|
|
|
|
|
|
|
| |
- This is designed to make it obvious that %clang_cc1 is a "test variable"
which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
can be useful to redefine what gets run as 'clang -cc1' (for example, to set
a default target).
llvm-svn: 91446
|
|
|
|
| |
llvm-svn: 90647
|
|
|
|
| |
llvm-svn: 90070
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
implements a framework that allows us to use information about previously
substituted values to simplify subsequent ones. Maybe this would be useful
for C++'y stuff, who knows. We now get:
t.c:4:21: error: invalid operands to binary expression ('size_t' (aka 'unsigned long *') and 'size_t')
return (size_t) 0 + (size_t) 0;
~~~~~~~~~~ ^ ~~~~~~~~~~
on the testcase. Note that size_t is only aka'd once.
llvm-svn: 84604
|
|
|
|
| |
llvm-svn: 81802
|
|
|
|
|
|
|
| |
Also, enable them in sema so that they are tested, and now that the x86 backend
has stablized.
llvm-svn: 74983
|
|
|
|
|
|
|
|
| |
-Makes typeof consistent with sizeof/alignof
-Fixes a bug when '>' is in a typeof expression, inside a template type param:
A<typeof(x>1)> a;
llvm-svn: 72255
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
scheme to be more useful.
The new scheme introduces a set of categories that should be more
readable, and also reflects what we want to consider as an extension
more accurately. Specifically, it makes the "what is a keyword"
determination accurately reflect whether the keyword is a GNU or
Microsoft extension.
I also introduced separate flags for keyword aliases; this is useful
because the classification of the aliases is mostly unrelated to the
classification of the original keyword.
This patch treats anything that's in the implementation
namespace (prefixed with "__", or "_X" where "X" is any upper-case
letter) as a keyword without marking it as an extension. This is
consistent with the standards in that an implementation is allowed to define
arbitrary extensions in the implementation namespace without violating
the standard. This gets rid of all the nasty "extension used" warnings
for stuff like __attribute__ in -pedantic mode. We still warn for
extensions outside of the the implementation namespace, like typeof.
If someone wants to implement -Wextensions or something like that, we
could add additional information to the keyword table.
This also removes processing for the unused "Boolean" language option;
such an extension isn't supported on any other C implementation, so I
don't see any point to adding it.
The changes to test/CodeGen/inline.c are required because previously, we
weren't actually disabling the "inline" keyword in -std=c89 mode.
I'll remove Boolean and NoExtensions from LangOptions in a follow-up
commit.
llvm-svn: 70281
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Strip off extra parens when looking for casts.
- Change the location info to point at the cast (instead of the
assignment).
For example, on
int *b;
#define a ((void*) b)
void f0() {
a = 10;
}
we now emit:
/tmp/t.c:4:3: error: assignment to cast is illegal, lvalue casts are not supported
a = 10;
^ ~
/tmp/t.c:2:12: note: instantiated from:
#define a ((void*) b)
~^~~~~~~~~~
instead of:
/tmp/t.c:4:5: error: expression is not assignable
a = 10;
~ ^
llvm-svn: 69114
|
|
|
|
|
|
| |
extension.
llvm-svn: 69100
|
|
|
|
|
|
|
|
|
|
|
|
| |
clang.
- We will eventually want some more driver infrastructre for this
probably.
- For now, the clang-cc interface stays relatively the same, but we
don't accept multiple instances anymore, or the [no-] variants
directly.
llvm-svn: 68550
|
|
|
|
|
|
|
| |
disable this feature for now, to err on the side of rejecting instead
of sometimes crashing. rdar://6326239
llvm-svn: 68088
|
|
|
|
|
|
|
|
|
| |
disabled but are used anyway
by changing blocks from being disabled in the parser to being disabled
in Sema.
llvm-svn: 67816
|
|
|
|
|
|
| |
Tests and drivers updated, still need to shuffle dirs.
llvm-svn: 67602
|
|
|
|
| |
llvm-svn: 66416
|
|
|
|
| |
llvm-svn: 66388
|
|
|
|
| |
llvm-svn: 66387
|
|
|
|
|
|
|
|
|
| |
assignment (+=)"
warning to only trigger when there is whitespace or something else after the + as
suggested by Eli.
llvm-svn: 66370
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
information about types. We often print diagnostics where we say
"foo_t" is bad, but the user doesn't know how foo_t is declared
(because it is a typedef). Fix this by expanding sugar when present
in a diagnostic (and not one of a few special cases, like vectors).
Before:
t.m:5:2: error: invalid operands to binary expression ('typeof(P)' and 'typeof(F)')
MAX(P, F);
^~~~~~~~~
t.m:1:78: note: instantiated from:
#define MAX(A,B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; })
^
After:
t.m:5:2: error: invalid operands to binary expression ('typeof(P)' (aka 'struct mystruct') and 'typeof(F)' (aka 'float'))
MAX(P, F);
^~~~~~~~~
t.m:1:78: note: instantiated from:
#define MAX(A,B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; })
^
llvm-svn: 65081
|
|
|
|
|
|
| |
just silently return an error to avoid bogus diagnostics.
llvm-svn: 64491
|
|
|
|
| |
llvm-svn: 62936
|