| Age | Commit message (Collapse) | Author |
|
The __deprecated marker is quite useful in highlighting the remnants of
old APIs that want removing.
However, it is quite normal for one or more years to pass, before the
(usually ancient, bitrotten) code in question is either updated or
deleted.
Thus, like __must_check, add a Kconfig option that permits the silencing
of this compiler warning.
This change mimics the ifdef-ery and Kconfig defaults of MUST_CHECK as
closely as possible.
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
|
To be consistent with the use of attributes in the rest of the kernel
replace all use of __attribute_pure__ with __pure and delete the definition
of __attribute_pure__.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Cc: Russell King <rmk@arm.linux.org.uk>
Acked-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Bryan Wu <bryan.wu@analog.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
|
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
|
gcc 4.3 supports a new __attribute__((__cold__)) to mark functions cold. Any
path directly leading to a call of this function will be unlikely. And gcc
will try to generate smaller code for the function itself.
Please use with care. The code generation advantage isn't large and in most
cases it is not worth uglifying code with this.
This patch marks some common error functions like panic(), printk()
as cold. This will longer term make many unlikely()s unnecessary, although
we can keep them for now for older compilers.
BUG is not marked cold because there is currently no way to tell
gcc to mark a inline function told.
Also all __init and __exit functions are marked cold. With a non -Os
build this will tell the compiler to generate slightly smaller code
for them. I think it currently only uses less alignments for labels,
but that might change in the future.
One disadvantage over *likely() is that they cannot be easily instrumented
to verify them.
Another drawback is that only the latest gcc 4.3 snapshots support this.
Unfortunately we cannot detect this using the preprocessor. This means older
snapshots will fail now. I don't think that's a problem because they are
unreleased compilers that nobody should be using.
gcc also has a __hot__ attribute, but I don't see any sense in using
this in the kernel right now. But someday I hope gcc will be able
to use more aggressive optimizing for hot functions even in -Os,
if that happens it should be added.
Includes compile fix from Thomas Gleixner.
Cc: Jan Hubicka <jh@suse.cz>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
|
The ifdef tests were broken. Assume it acts like gcc 4
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
|
__used is defined to be __attribute__((unused)) for all pre-3.3 gcc
compilers to suppress warnings for unused functions because perhaps they
are referenced only in inline assembly. It is defined to be
__attribute__((used)) for gcc 3.3 and later so that the code is still
emitted for such functions.
__maybe_unused is defined to be __attribute__((unused)) for both function
and variable use if it could possibly be unreferenced due to the evaluation
of preprocessor macros. Function prototypes shall be marked with
__maybe_unused if the actual definition of the function is dependant on
preprocessor macros.
No update to compiler-intel.h is necessary because ICC supports both
__attribute__((used)) and __attribute__((unused)) as specified by the gcc
manual.
__attribute_used__ is deprecated and will be removed once all current
code is converted to using __used.
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Adrian Bunk <bunk@stusta.de>
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
|
Change prototypes for __chk_user_ptr and __chk_io_ptr to take const
void* instead of void*, so that code can pass "const void *" to them.
(Right now sparse does not warn about passing const void* to void*
functions, but that is a separate bug that I believe Josh is working on,
and once sparse does check this, the changed prototypes will be
necessary.)
Signed-off-by: Russ Cox <rsc@swtch.com>
Signed-off-by: Josh Triplett <josh@freedesktop.org>
Acked-by: Christopher Li <sparse@chrisli.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
|
The kernel doesn't compile with GCC <3.2, do not allow it to succeed if GCC
3.0.x or 3.1.x are used.
Signed-off-by: Alistair John Strachan <s0348365@sms.ed.ac.uk>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
|
|
The lock annotation macros __acquires, __releases, __acquire, and __release
all currently throw away the lock expression passed as an argument. Now
that sparse can parse __context__ and __attribute__((context)) with a
context expression, pass the lock expression down to sparse as the context
expression. This requires a version of sparse from GIT commit
37475a6c1c3e66219e68d912d5eb833f4098fd72 or later.
Signed-off-by: Josh Triplett <josh@freedesktop.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Currently, __acquire and __release take a lock expression, but __cond_lock
takes only a condition, not the lock acquired if the expression evaluates
to true. Change __cond_lock to accept a lock expression, and change all
the callers to pass in a lock expression.
Signed-off-by: Josh Triplett <josh@freedesktop.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Those 1500 warnings can be a bit of a pain. Add a config option to shut them
up.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
|
|
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
|
|
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
|
|
There's one scsi driver which doesn't compile due to weird __VA_ARGS__ tricks
and the rather useful scsi/sd.c is currently getting an ICE. None of the new
SAS code compiles, due to extensive use of anonymous unions. The V4L guys are
very good at exploiting the gcc-2.95.x macro expansion bug (_why_ does each
driver need to implement its own debug macros?) and various people keep on
sneaking in anonymous unions, which are rather nice.
Plus anonymous unions are rather useful.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Add a deprecated_for_modules macro that allows symbols to be deprecated only
when used by modules, as suggested by Andrew Morton some months back.
Signed-off-by: Paul E. McKenney <paulmck@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
where implicit casts are not appropriate.
This can be used to mark unsigned integers as being uncastable
to signed, for example. Or enums as not degrading to integers
and vice versa.
|
|
small nitpick, __KERNEL__ is the inner ifdef.
Signed-off-by: Olaf Hering <olh@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
With the release of gcc 4.0 being only a few months away and people
already tring compiling with it, it's time for adding a compiler-gcc4.h .
This patch contains the following changes:
- remove compiler-gcc+.h
- compiler-gcc4.h: new file based on a corrected compiler-gcc+.h
- compiler.h: include compiler-gcc4.h for gcc 4
- compiler.h: #error for gcc > 4
- compiler-gcc3.h: remove __compiler_offsetof (there will never be a
gcc 3.5)
small indention corrections
I've tested the compilation with both gcc 3.4.4 and a recent gcc 4.0
snapshot from Debian experimental.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
and atomic_dec_and_lock.
This means that we now have all of the spinlock context counting
infrastructure in place, and you can check-compile the kernel with
sparse -Wcontext.
|
|
This just sets up the portability defines.
|
|
None of the compatibility defines make sense for assembly
files, and gcc has trouble with vararg macros when using
"-traditional" (which is used for asm), to the point of
ICE'ing.
|
|
|
|
Allows us to do compile-time sparse warnings of our own.
|
|
There's tons of mis-use of PCI memory-mapped IO that is used
as if it was regular memory. That fails disastrously on a number
of architectures, and it doesn't help that it just happens to
work on regular x86 boxes.
This makes makes us do much stricter type-checking. Some of it
visible to the regular compiler, but the bulk of it is for sparse.
|
|
Trivial gcc-3.5 build fixes.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
The patch below uses the new-in-gcc-3.4 option to generate a warning on
unchecked results of marked functions, and applies this to the
inode_setattr function (which based on recent bk commits HAS to be checked
for it's return value for correct operation). A warning looks like this:
fs/ext2/inode.c:1279: warning: ignoring return value of 'inode_setattr', declared with attribute warn_unused_result
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Older versions of gcc were unhappy with our previous trick, and
just separating out the __CHECKER__ case made it much simpler.
|
|
|
|
|
|
From: Ville Nuorvala <vnuorval@tcs.hut.fi>
There are a few kernel-only things in compiler.h which should have been
placed inside __KERNEL__.
|
|
From: Andi Kleen <ak@muc.de>
This patch adds the `noinline' function attribute. It can be used to
explicitly tell the compiler to not inline functions.
We need this due to what is, IMO, a bug present in gcc-3.4 and current
gcc-3.5 CVS: the compiler is inlining init/main.c:rest_init() inside
init/main.c:start_kernel(), despite the fact that thay are declared to be
placed in different text sections.
|
|
user program inclusion.
It's still wrong to include kernel headers from
user programs. Oh, well.
|
|
From: "H. Peter Anvin" <hpa@zytor.com>
Declaring a function to return a const scalar value is pretty meaningless.
These functions are really trying to say that they don't alter any external
state.
Fix that up by using __attribute__((const)), if the compiler supports that.
|
|
From: Jun Sun <jsun@mvista.com>
It is needed for all those "__attribute_used__" etc to be valid.
Also, it seems that when compiling a file ending in ".S", gcc-2.95.3 does not
expand __GNUC__ at all. This causes the compiler version check to fail when
building vsyscall.S. So add __ASSEMBLY__ wrappers in there.
|
|
From: "Nakajima, Jun" <jun.nakajima@intel.com>
Split the increasingly messy compiler.h file into per-compiler files and also
add support for non-gcc compilers.
With the current implementation:
include/linux/compiler.h defines the compiler-dependent abstractions
which can be overwritten by per-compiler definitions.
include/linux/compiler-gcc.h contains the common definitions for all gcc
versions.
include/linux/compiler-gcc[2,3,+].h contains gcc major version specific
definitions.
include/linux/compiler-intel.h contains intel compiler specific
definitions."
|
|
From: Albert Cahalan <albert@users.sourceforge.net>
1. allows likely() and unlikely() to work for pointers
2. fixes likely() (in C, any non-zero value is true)
|
|
consistently.
|
|
- export the __div64_32 symbol for modules;
- add likely() to the fast path (divisor>>32 == 0);
- add __attribute__((pure)) to __div64_32() prototype so
the compiler knows global memory isn't clobbered;
- avoid building __div64_32() on 64bit architectures.
|
|
must never be dereferenced directly. Make that clear in the
attribute.
|
|
checking, these end up being no-ops, but they get enabled
by the type checker as special address_space attributes.
|
|
Force inlining even when gcc-3.x is too confused to do it for us.
|
|
The compiler.h fragment should describe the problem well enough.
|
|
on the end of __GNUC_MINOR"
|
|
James Bottomley confirmed the "deprecated" attribute requires gcc 3.1
and onward, not gcc 3.0.
This updates the check in compiler.h accordingly.
|
|
Rename the deprecated attribute to __deprecated to make it obvious
this is something special and to avoid namespace clashes.
Mark old module interfaces deprecated.
|
|
This patch adds support for usage of the attribute as "deprecated" and
is backward-compatible. Usage is:
int deprecated foo(void)
etc..
If we mark a function as deprecated, then each use of the function emits
a warning like:
foo.c:12: warning: `baz' is deprecated (declared at bar.c:60)
Which is very informative, giving both the location of each usage and
where the little bastard is declared.
|
|
RELOC_HIDE got miscompiled on gcc3.1/x86-64 in the access to softirq.c's per
cpu variables. This fixes the problem.
Clearly to hide the relocation the addition needs to be done after the
value obfuscation, not before.
I don't know if it triggers on other architectures (x86-64 is especially
stressf here because it has negative kernel addresses), but seems like the
right thing to do.
|
|
As per David Mosberger's request, splits into per-arch files (solves the
#include mess), and fixes my "was not an lvalue" bug.
|
|
|
|
This is the Richard Henderson-approved, cleaner, brighter per-cpu patch.
|