Re: [PATCH] gcc version 5: add basic definition header for latest gcc version
From: Jakub Jelinek
Date: Fri Aug 15 2014 - 15:31:07 EST
On Fri, Aug 15, 2014 at 03:23:01PM -0400, Paul Gortmaker wrote:
> --- /dev/null
> +++ b/include/linux/compiler-gcc5.h
> @@ -0,0 +1,52 @@
> +#ifndef __LINUX_COMPILER_H
> +#error "Please don't include <linux/compiler-gcc5.h> directly, include <linux/compiler.h> instead."
> +#endif
> +
> +#define __used __attribute__((__used__))
> +#define __must_check __attribute__((warn_unused_result))
> +#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
> +
> +/* Mark functions as cold. gcc will assume any path leading to a call
> + to them will be unlikely. This means a lot of manual unlikely()s
> + are unnecessary now for any paths leading to the usual suspects
> + like BUG(), printk(), panic() etc. [but let's keep them for now for
> + older compilers]
> +
> + Early snapshots of gcc 4.3 don't support this and we can't detect this
> + in the preprocessor, but we can live with this because they're unreleased.
> + Maketime probing would be overkill here.
The above 4 lines are probably unnecessary.
More importantly, is it a good idea to store the gcc major number in the
header? gcc 5.x will be released next year, but the year after that we'll
have gcc 6.x, so you'd need to copy this header each year.
Jakub
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/