LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Joe Perches <joe@perches.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Michal Nazarewicz <mina86@mina86.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernel.h: Remove ancient __FUNCTION__ hack
Date: Wed, 4 Feb 2015 14:35:15 -0800	[thread overview]
Message-ID: <20150204143515.8bd14a53fceae8f38b0b0e8d@linux-foundation.org> (raw)
In-Reply-To: <1423087515.16386.15.camel@perches.com>

On Wed, 04 Feb 2015 14:05:15 -0800 Joe Perches <joe@perches.com> wrote:

> On Wed, 2015-02-04 at 23:01 +0100, Rasmus Villemoes wrote:
> > On Wed, Feb 04 2015, Joe Perches <joe@perches.com> wrote:
> > 
> > > On Wed, 2015-02-04 at 21:55 +0100, Rasmus Villemoes wrote:
> > >> On Wed, Feb 04 2015, Joe Perches <joe@perches.com> 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(-)

diff -puN include/linux/kernel.h~kernelh-remove-ancient-__function__-hack-fix include/linux/kernel.h
diff -puN arch/x86/kernel/hpet.c~kernelh-remove-ancient-__function__-hack-fix arch/x86/kernel/hpet.c
--- a/arch/x86/kernel/hpet.c~kernelh-remove-ancient-__function__-hack-fix
+++ a/arch/x86/kernel/hpet.c
@@ -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)
 
 /*
diff -puN arch/x86/kernel/rtc.c~kernelh-remove-ancient-__function__-hack-fix arch/x86/kernel/rtc.c
--- a/arch/x86/kernel/rtc.c~kernelh-remove-ancient-__function__-hack-fix
+++ a/arch/x86/kernel/rtc.c
@@ -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;
diff -puN arch/x86/platform/intel-mid/intel_mid_vrtc.c~kernelh-remove-ancient-__function__-hack-fix arch/x86/platform/intel-mid/intel_mid_vrtc.c
--- a/arch/x86/platform/intel-mid/intel_mid_vrtc.c~kernelh-remove-ancient-__function__-hack-fix
+++ a/arch/x86/platform/intel-mid/intel_mid_vrtc.c
@@ -110,7 +110,7 @@ int vrtc_set_mmss(const struct timespec
 		spin_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;
diff -puN drivers/block/xen-blkfront.c~kernelh-remove-ancient-__function__-hack-fix drivers/block/xen-blkfront.c
--- a/drivers/block/xen-blkfront.c~kernelh-remove-ancient-__function__-hack-fix
+++ a/drivers/block/xen-blkfront.c
@@ -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;
 			}
 		}
diff -puN include/acpi/acoutput.h~kernelh-remove-ancient-__function__-hack-fix include/acpi/acoutput.h
--- a/include/acpi/acoutput.h~kernelh-remove-ancient-__function__-hack-fix
+++ a/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.
  */
 #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 */
diff -puN drivers/acpi/acpica/utdebug.c~kernelh-remove-ancient-__function__-hack-fix drivers/acpi/acpica/utdebug.c
--- a/drivers/acpi/acpica/utdebug.c~kernelh-remove-ancient-__function__-hack-fix
+++ a/drivers/acpi/acpica/utdebug.c
@@ -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.
  *
  ******************************************************************************/
 
_


  reply	other threads:[~2015-02-04 22:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-04  9:48 Rasmus Villemoes
2015-02-04 19:06 ` Joe Perches
2015-02-04 20:55   ` Rasmus Villemoes
2015-02-04 21:03     ` Joe Perches
2015-02-04 22:01       ` Rasmus Villemoes
2015-02-04 22:05         ` Joe Perches
2015-02-04 22:35           ` Andrew Morton [this message]
2015-02-04 22:49             ` Joe Perches
2015-02-04 23:05               ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150204143515.8bd14a53fceae8f38b0b0e8d@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=mina86@mina86.com \
    --subject='Re: [PATCH] kernel.h: Remove ancient __FUNCTION__ hack' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).