Re: [PATCH] kernel.h: Remove ancient __FUNCTION__ hack

From: Joe Perches
Date: Wed Feb 04 2015 - 17:49:24 EST


On Wed, 2015-02-04 at 14:35 -0800, Andrew Morton wrote:
> On Wed, 04 Feb 2015 14:05:15 -0800 Joe Perches <joe@xxxxxxxxxxx> wrote:
> > On Wed, 2015-02-04 at 23:01 +0100, Rasmus Villemoes wrote:
> > > On Wed, Feb 04 2015, Joe Perches <joe@xxxxxxxxxxx> wrote:
> > > > On Wed, 2015-02-04 at 21:55 +0100, Rasmus Villemoes wrote:
> > > >> On Wed, Feb 04 2015, Joe Perches <joe@xxxxxxxxxxx> wrote:
> > > >> > On Wed, 2015-02-04 at 10:48 +0100, Rasmus Villemoes wrote:
> > > >> >> __FUNCTION__ hasn't been treated as a string literal since gcc 3.4, so
> > > >> >> this only helps people who only test-compile using 3.3
> > > >> >> (compiler-gcc3.h barks at anything older than that). Besides, there
> > > >> >> are almost no occurrences of __FUNCTION__ left in the tree.
> > > >> > The remaining uses of __FUNCTION__ need converting first.
> > > >> Why? __FUNCTION__ is recognized just fine by gcc as an alias for __func__.
> > > > And icc and clang and ...?
> > > clang yes, icc probably (from quick googling).
> > Cool, but it does seem safer/more conservative to me to
> > convert the last 3 uses before doing this.

[]

> arch/x86/kernel/hpet.c | 2 +-
> arch/x86/kernel/rtc.c | 4 ++--
> arch/x86/platform/intel-mid/intel_mid_vrtc.c | 2 +-
> drivers/acpi/acpica/utdebug.c | 4 ++--
> drivers/block/xen-blkfront.c | 2 +-
> include/acpi/acoutput.h | 6 +++---
> 6 files changed, 10 insertions(+), 10 deletions(-)

Thanks. I had submitted patches for all the
actual code uses (but not the comments) awhile ago.

trivia about macros vs c99 predefined identifiers below:

> diff -puN include/acpi/acoutput.h~kernelh-remove-ancient-__function__-hack-fix include/acpi/acoutput.h
[]
> @@ -240,7 +240,7 @@
> /*
> * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header,
> * define it now. This is the case where there the compiler does not support
> - * a __FUNCTION__ macro or equivalent.
> + * a __func__ macro or equivalent.

Do these still make sense? __func__ isn't a macro.

> @@ -249,12 +249,12 @@
[]
> - * and macros such as __FUNCTION__.
> + * and macros such as __func__.
[]
> -/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */
> +/* Compiler supports __func__ (or equivalent) -- Ignore this macro */
[]
> diff -puN drivers/acpi/acpica/utdebug.c~kernelh-remove-ancient-__function__-hack-fix drivers/acpi/acpica/utdebug.c

> @@ -111,8 +111,8 @@ void acpi_ut_track_stack_ptr(void)
[]
> - * This allows compiler macros such as __FUNCTION__ to be used
> - * with no change to the debug output.
> + * This allows compiler macros such as __func__ to be used with no
> + * change to the debug output.


--
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/