kernel.h: Remove ancient __FUNCTION__ hack
Subsystems (8)
PATCH 1/1 kernel.h: Remove ancient __FUNCTION__ hack
__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.
--- include/linux/kernel.h | 3 --- 1 file changed, 3 deletions(-)
include/linux/kernel.h +0 -3
@@ -799,9 +799,6 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { } const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );}) -/* Trap pasters of __FUNCTION__ at compile-time */ -#define __FUNCTION__ (__func__) -/* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */ #ifdef CONFIG_FTRACE_MCOUNT_RECORD # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
Signature · 1 line
2.1.3
Quoted 4 lines · Rasmus Villemoes
__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.hbarks 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.
arch/x86/kernel/hpet.c: _hpet_print_config(__FUNCTION__, __LINE__); arch/x86/kernel/rtc.c: __FUNCTION__, retval); arch/x86/kernel/rtc.c: __FUNCTION__, nowtime);
Quoted 7 lines · Joe Perches
Quoted 4 lines · Rasmus Villemoes
__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.hbarks 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__.
Rasmus
Quoted 11 lines · Rasmus Villemoes
Quoted 7 lines · Joe Perches
Quoted 4 lines · Rasmus Villemoes
__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.hbarks 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 ...?
Quoted 9 lines · Joe Perches
Quoted 8 lines · Rasmus Villemoes
Quoted 6 lines · Joe Perches
Quoted 4 lines · Rasmus Villemoes
__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.hbarks at anything older than that). Besides, there are almost no occurrences of__FUNCTION__left in the tree.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
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).
Quoted 11 lines · Rasmus Villemoes
Quoted 9 lines · Joe Perches
Quoted 8 lines · Rasmus Villemoes
Quoted 6 lines · Joe Perches
Quoted 4 lines · Rasmus Villemoes
__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.hbarks at anything older than that). Besides, there are almost no occurrences of__FUNCTION__left in the tree.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
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.
Quoted 14 lines · On Wed, 04 Feb 2015 14:05:15 -0800 Joe Perches <[email protected]> wrote:
Quoted 13 lines · Rasmus Villemoes
Quoted 11 lines · Joe Perches
Quoted 10 lines · Rasmus Villemoes
Quoted 7 lines · Joe Perches
Quoted 4 lines · Rasmus Villemoes
__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.hbarks 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.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
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(-)
diff -puN include/linux/kernel.h~kernelh-remove-ancient-__function__-hack-fix include/linux/kernel.h
arch/x86/kernel/hpet.c renamed from arch/x86/kernel/hpet.c~kernelh-remove-ancient-__function__-hack-fix +1 -1
@@ -168,7 +168,7 @@ static void _hpet_print_config(const cha#define hpet_print_config () \ do { \ if (hpet_verbose) \ - _hpet_print_config(__FUNCTION__, __LINE__); \ + _hpet_print_config(__func__, __LINE__); \ } while (0)/*
arch/x86/kernel/rtc.c renamed from arch/x86/kernel/rtc.c~kernelh-remove-ancient-__function__-hack-fix +2 -2
@@ -49,11 +49,11 @@ int mach_set_rtc_mmss(const struct times retval =set_rtc_time (&tm);if (retval)printk (KERN_ERR "%s: RTC write failed with error %d\n" , - __FUNCTION__, retval); + __func__, retval); }else {printk (KERN_ERR "%s: Invalid RTC value: write of %lx to RTC failed\n" , - __FUNCTION__, nowtime); + __func__, nowtime); retval = -EINVAL ; }return retval;
arch/x86/platform/intel-mid/intel_mid_vrtc.c renamed from arch/x86/platform/intel-mid/intel_mid_vrtc.c~kernelh-remove-ancient-__function__-hack-fix +1 -1
@@ -110,7 +110,7 @@ int vrtc_set_mmss(const struct timespecspin_unlock_irqrestore (&rtc_lock, flags); }else {pr_err ("%s: Invalid vRTC value: write of %lx to vRTC failed\n" , - __FUNCTION__, now->tv_sec); + __func__, now->tv_sec); retval = -EINVAL ; }return retval;
drivers/block/xen-blkfront.c renamed from drivers/block/xen-blkfront.c~kernelh-remove-ancient-__function__-hack-fix +1 -1
@@ -1391,7 +1391,7 @@ static int blkfront_probe(struct xenbus_if (major !=XENVBD_MAJOR ) {printk (KERN_INFO "%s: HVM does not support vbd %d as xen block device\n" , - __FUNCTION__, vdevice); + __func__, vdevice);return -ENODEV ; } }
include/acpi/acoutput.h renamed from include/acpi/acoutput.h~kernelh-remove-ancient-__function__-hack-fix +3 -3
@@ -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. */ #ifndef ACPI_GET_FUNCTION_NAME #define ACPI_GET_FUNCTION_NAME _acpi_function_name
@@ -249,12 +249,12 @@* The Name parameter should be the procedure name as a quoted string. * The function name is also used by the function exit macros below. * Note: (const char) is used to be compatible with the debug interfaces -* and macros such as __FUNCTION__. +* and macros such as __func__. */ #define ACPI_FUNCTION_NAME (name) static const char _acpi_function_name[] = #name;#else -/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ +/* Compiler supports __func__ (or equivalent) -- Ignore this macro */ #define ACPI_FUNCTION_NAME (name)#endif /* ACPI_GET_FUNCTION_NAME */
drivers/acpi/acpica/utdebug.c renamed from drivers/acpi/acpica/utdebug.c~kernelh-remove-ancient-__function__-hack-fix +2 -2
@@ -111,8 +111,8 @@ void acpi_ut_track_stack_ptr(void)* RETURN: Updated pointer to the function name * * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present. -* 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. * ******************************************************************************/
_
Quoted 10 lines · Andrew Morton
Quoted 9 lines · On Wed, 04 Feb 2015 14:05:15 -0800 Joe Perches <[email protected]> wrote:
Quoted 8 lines · Rasmus Villemoes
Quoted 7 lines · Joe Perches
Quoted 6 lines · Rasmus Villemoes
Quoted 5 lines · Joe Perches
Quoted 4 lines · Rasmus Villemoes
__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.hbarks at anything older than that). Besides, there are almost no occurrences of__FUNCTION__left in the tree.
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
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.
[]
Quoted 7 lines
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:
Quoted 1 line
diff -puN
include/acpi/acoutput.h~kernelh-remove-ancient-__function__-hack-fixinclude/acpi/acoutput.h
[]
include/acpi/acoutput.h line 243
Quoted 6 lines
include/acpi/acoutput.h renamed from include/acpi/acoutput.h~kernelh-remove-ancient-__function__-hack-fix +1
-1@@ -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.
Review
Quoted 1 line
(quoted diff) +0
-0@@ -249,12 +249,12 @@
[]
include/acpi/acoutput.h line 252
Quoted 2 lines
include/acpi/acoutput.h renamed from include/acpi/acoutput.h~kernelh-remove-ancient-__function__-hack-fix +1
-1-* and macros such as __FUNCTION__. +* and macros such as __func__.
[]
include/acpi/acoutput.h line 257
Quoted 2 lines
include/acpi/acoutput.h renamed from include/acpi/acoutput.h~kernelh-remove-ancient-__function__-hack-fix +1
-1-/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ +/* Compiler supports __func__ (or equivalent) -- Ignore this macro */
[]
Review void acpi_ut_track_stack_ptr(void)
Quoted 3 lines
diff -puN
drivers/acpi/acpica/utdebug.c~kernelh-remove-ancient-__function__-hack-fixdrivers/acpi/acpica/utdebug.c(quoted diff) +0
-0@@ -111,8 +111,8 @@ void acpi_ut_track_stack_ptr(void)
[]
Quoted 4 lines
drivers/acpi/acpica/utdebug.c renamed from drivers/acpi/acpica/utdebug.c~kernelh-remove-ancient-__function__-hack-fix +2
-2-* 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.
Quoted 4 lines · On Wed, 04 Feb 2015 14:49:17 -0800 Joe Perches <[email protected]> wrote:
trivia about macros vs c99 predefined identifiers below:
Quoted 1 line
diff -puN
include/acpi/acoutput.h~kernelh-remove-ancient-__function__-hack-fixinclude/acpi/acoutput.h[]
Quoted 8 lines
include/acpi/acoutput.h line 243
Quoted 6 lines
include/acpi/acoutput.h renamed from include/acpi/acoutput.h~kernelh-remove-ancient-__function__-hack-fix +1
-1@@ -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.
Yeah, but I was too lazy to think up more appropriate text. Hey, it's only ACPI :)