Patchwork Standardize on using __func__ instead of __FUNCTION__

login
register
about
Submitter Uwe Hermann
Date 2009-09-02 16:09:43
Message ID <20090902160942.GC10404@greenwood>
Download mbox | patch
Permalink /patch/239/
State Accepted
Commit r711
Headers show

Comments

Uwe Hermann - 2009-09-02 16:09:43
See patch.


Uwe.
Stefan Reinauer - 2009-09-02 16:23:07
Uwe Hermann wrote:
> See patch.

For all debugging messages:
Acked-by: Stefan Reinauer <stepan@coresystems.de>

But this:

> Index: ft2232_spi.c
> ===================================================================
> --- ft2232_spi.c	(Revision 710)
> +++ ft2232_spi.c	(Arbeitskopie)
> @@ -285,7 +285,7 @@
>  			l = total_size - i;
>  
>  		if ((r = spi_nbyte_program(i, &buf[i], l))) {
> -			fprintf(stderr, "%s: write fail %d\n", __FUNCTION__, r);
> +			fprintf(stderr, "%s: write fail %d\n", __func__, r);
>  			return 1;
>  		}
>  		
Error messages (ie. not _debugging_ messages) should not contain 
function names and numbers but descriptive error messages.
Uwe Hermann - 2009-09-02 22:10:10
On Wed, Sep 02, 2009 at 06:23:07PM +0200, Stefan Reinauer wrote:
> Uwe Hermann wrote:
> >See patch.
> 
> For all debugging messages:
> Acked-by: Stefan Reinauer <stepan@coresystems.de>

Thanks, r711.

 
> But this:
> 
> >Index: ft2232_spi.c
> >===================================================================
> >--- ft2232_spi.c	(Revision 710)
> >+++ ft2232_spi.c	(Arbeitskopie)
> >@@ -285,7 +285,7 @@
> > 			l = total_size - i;
> > 		if ((r = spi_nbyte_program(i, &buf[i], l))) {
> >-			fprintf(stderr, "%s: write fail %d\n", __FUNCTION__, r);
> >+			fprintf(stderr, "%s: write fail %d\n", __func__, r);
> > 			return 1;
> > 		}
> > 		
> Error messages (ie. not _debugging_ messages) should not contain
> function names and numbers but descriptive error messages.

Agreed, this is for another patch, though.


Uwe.

Patch

Standardize on using __func__ instead of __FUNCTION__.

The __func__ variant is standardized in C99 and recommended to be
used instead of __FUNCTION__ in the gcc info page.

Only _very_ old versions of gcc did not know about __func__, but we've
been using both __func__ and __FUNCTION__ for a long while now, and
nobody complained about this, so all our users seem to use recent
enough compilers.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>

Index: en29f002a.c
===================================================================
--- en29f002a.c	(Revision 710)
+++ en29f002a.c	(Arbeitskopie)
@@ -47,7 +47,7 @@ 
 	chip_writeb(0x55, bios + 0x2AA);
 	chip_writeb(0xF0, bios + 0x555);
 
-	printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __FUNCTION__, id1, id2);
+	printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __func__, id1, id2);
 
 	if (id1 == flash->manufacture_id && id2 == flash->model_id)
 		return 1;
@@ -80,7 +80,7 @@ 
 	chip_writeb(0x55, bios + 0xAAA);
 	chip_writeb(0xF0, bios + 0x555);
 
-	printf_debug("%s: id1 0x%x, id2 0x%x\n", __FUNCTION__, id1, id2);
+	printf_debug("%s: id1 0x%x, id2 0x%x\n", __func__, id1, id2);
 
 	if (id1 == flash->manufacture_id && id2 == flash->model_id)
 		return 1;
Index: it87spi.c
===================================================================
--- it87spi.c	(Revision 710)
+++ it87spi.c	(Arbeitskopie)
@@ -168,7 +168,7 @@ 
 	} while (busy);
 	if (readcnt > 3) {
 		printf("%s called with unsupported readcnt %i.\n",
-		       __FUNCTION__, readcnt);
+		       __func__, readcnt);
 		return SPI_INVALID_LENGTH;
 	}
 	switch (writecnt) {
@@ -198,7 +198,7 @@ 
 		break;
 	default:
 		printf("%s called with unsupported writecnt %i.\n",
-		       __FUNCTION__, writecnt);
+		       __func__, writecnt);
 		return SPI_INVALID_LENGTH;
 	}
 	/*
Index: jedec.c
===================================================================
--- jedec.c	(Revision 710)
+++ jedec.c	(Arbeitskopie)
@@ -145,7 +145,7 @@ 
 	chip_writeb(0xF0, bios + 0x5555);
 	programmer_delay(probe_timing_exit);
 
-	printf_debug("%s: id1 0x%02x, id2 0x%02x", __FUNCTION__, largeid1, largeid2);
+	printf_debug("%s: id1 0x%02x, id2 0x%02x", __func__, largeid1, largeid2);
 	if (!oddparity(id1))
 		printf_debug(", id1 parity violation");
 
Index: w29ee011.c
===================================================================
--- w29ee011.c	(Revision 710)
+++ w29ee011.c	(Arbeitskopie)
@@ -61,7 +61,7 @@ 
 	chip_writeb(0xF0, bios + 0x5555);
 	programmer_delay(10);
 
-	printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __FUNCTION__, id1, id2);
+	printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __func__, id1, id2);
 
 	if (id1 == flash->manufacture_id && id2 == flash->model_id)
 		return 1;
Index: sst49lfxxxc.c
===================================================================
--- sst49lfxxxc.c	(Revision 710)
+++ sst49lfxxxc.c	(Arbeitskopie)
@@ -141,7 +141,7 @@ 
 
 	chip_writeb(RESET, bios);
 
-	printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __FUNCTION__, id1, id2);
+	printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __func__, id1, id2);
 
 	if (!(id1 == flash->manufacture_id && id2 == flash->model_id))
 		return 0;
Index: sharplhf00l04.c
===================================================================
--- sharplhf00l04.c	(Revision 710)
+++ sharplhf00l04.c	(Arbeitskopie)
@@ -60,7 +60,7 @@ 
 
 	programmer_delay(10);
 
-	printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __FUNCTION__, id1, id2);
+	printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __func__, id1, id2);
 
 	if (id1 != flash->manufacture_id || id2 != flash->model_id)
 		return 0;
Index: spi.c
===================================================================
--- spi.c	(Revision 710)
+++ spi.c	(Arbeitskopie)
@@ -264,7 +264,7 @@ 
 		id2 = (readarr[1] << 8) | readarr[2];
 	}
 
-	printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __FUNCTION__, id1, id2);
+	printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __func__, id1, id2);
 
 	if (id1 == flash->manufacture_id && id2 == flash->model_id) {
 		/* Print the status register to tell the
@@ -321,7 +321,7 @@ 
 	id1 = readarr[0];
 	id2 = readarr[1];
 
-	printf_debug("%s: id1 0x%x, id2 0x%x\n", __FUNCTION__, id1, id2);
+	printf_debug("%s: id1 0x%x, id2 0x%x\n", __func__, id1, id2);
 
 	if (id1 == flash->manufacture_id && id2 == flash->model_id) {
 		/* Print the status register to tell the
@@ -356,7 +356,7 @@ 
 		return 0;
 
 	id2 = readarr[0];
-	printf_debug("%s: id 0x%x\n", __FUNCTION__, id2);
+	printf_debug("%s: id 0x%x\n", __func__, id2);
 	if (id2 != flash->model_id)
 		return 0;
 
Index: ft2232_spi.c
===================================================================
--- ft2232_spi.c	(Revision 710)
+++ ft2232_spi.c	(Arbeitskopie)
@@ -285,7 +285,7 @@ 
 			l = total_size - i;
 
 		if ((r = spi_nbyte_program(i, &buf[i], l))) {
-			fprintf(stderr, "%s: write fail %d\n", __FUNCTION__, r);
+			fprintf(stderr, "%s: write fail %d\n", __func__, r);
 			return 1;
 		}
 		
Index: sst28sf040.c
===================================================================
--- sst28sf040.c	(Revision 710)
+++ sst28sf040.c	(Arbeitskopie)
@@ -111,7 +111,7 @@ 
 	chip_writeb(RESET, bios);
 	programmer_delay(10);
 
-	printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __FUNCTION__, id1, id2);
+	printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __func__, id1, id2);
 	if (id1 == flash->manufacture_id && id2 == flash->model_id)
 		return 1;
 
Index: stm50flw0x0x.c
===================================================================
--- stm50flw0x0x.c	(Revision 710)
+++ stm50flw0x0x.c	(Arbeitskopie)
@@ -80,7 +80,7 @@ 
 	chip_writeb(0xF0, bios + 0x5555);
 	programmer_delay(40);
 
-	printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __FUNCTION__, largeid1,
+	printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __func__, largeid1,
 		     largeid2);
 
 	if (largeid1 != flash->manufacture_id || largeid2 != flash->model_id)
Index: am29f040b.c
===================================================================
--- am29f040b.c	(Revision 710)
+++ am29f040b.c	(Arbeitskopie)
@@ -84,7 +84,7 @@ 
 
 	programmer_delay(10);
 
-	printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __FUNCTION__, id1, id2);
+	printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __func__, id1, id2);
 	if (id1 == flash->manufacture_id && id2 == flash->model_id)
 		return 1;
 
Index: w39v080fa.c
===================================================================
--- w39v080fa.c	(Revision 710)
+++ w39v080fa.c	(Arbeitskopie)
@@ -41,7 +41,7 @@ 
 	chip_writeb(0xF0, bios + 0x5555);
 	programmer_delay(10);
 
-	printf_debug("%s: id1 0x%x, id2 0x%x\n", __FUNCTION__, id1, id2);
+	printf_debug("%s: id1 0x%x, id2 0x%x\n", __func__, id1, id2);
 
 	if (id1 != flash->manufacture_id || id2 != flash->model_id)
 		return 0;
Index: ichspi.c
===================================================================
--- ichspi.c	(Revision 710)
+++ ichspi.c	(Arbeitskopie)
@@ -216,7 +216,7 @@ 
 	uint32_t opmenu[2];
 
 	if (op == NULL) {
-		printf_debug("\n%s: null OPCODES pointer!\n", __FUNCTION__);
+		printf_debug("\n%s: null OPCODES pointer!\n", __func__);
 		return -1;
 	}
 
@@ -235,7 +235,7 @@ 
 		opmenu[1] = REGREAD32(ICH9_REG_OPMENU + 4);
 		break;
 	default:
-		printf_debug("%s: unsupported chipset\n", __FUNCTION__);
+		printf_debug("%s: unsupported chipset\n", __func__);
 		return -1;
 	}
 
@@ -317,7 +317,7 @@ 
 		REGWRITE32(ICH9_REG_OPMENU + 4, opmenu[1]);
 		break;
 	default:
-		printf_debug("%s: unsupported chipset\n", __FUNCTION__);
+		printf_debug("%s: unsupported chipset\n", __func__);
 		return -1;
 	}
 
@@ -610,7 +610,7 @@ 
 			return SPI_INVALID_LENGTH;
 		return ich9_run_opcode(op, offset, datalength, data);
 	default:
-		printf_debug("%s: unsupported chipset\n", __FUNCTION__);
+		printf_debug("%s: unsupported chipset\n", __func__);
 	}
 
 	/* If we ever get here, something really weird happened */
Index: 82802ab.c
===================================================================
--- 82802ab.c	(Revision 710)
+++ 82802ab.c	(Arbeitskopie)
@@ -68,7 +68,7 @@ 
 
 	programmer_delay(10);
 
-	printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __FUNCTION__, id1, id2);
+	printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __func__, id1, id2);
 
 	if (id1 != flash->manufacture_id || id2 != flash->model_id)
 		return 0;
Index: mx29f002.c
===================================================================
--- mx29f002.c	(Revision 710)
+++ mx29f002.c	(Arbeitskopie)
@@ -36,7 +36,7 @@ 
 
 	programmer_delay(10);
 
-	printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __FUNCTION__, id1, id2);
+	printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __func__, id1, id2);
 	if (id1 == flash->manufacture_id && id2 == flash->model_id)
 		return 1;
 
Index: m29f400bt.c
===================================================================
--- m29f400bt.c	(Revision 710)
+++ m29f400bt.c	(Arbeitskopie)
@@ -75,7 +75,7 @@ 
 
 	programmer_delay(10);
 
-	printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __FUNCTION__, id1, id2);
+	printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __func__, id1, id2);
 
 	if (id1 == flash->manufacture_id && id2 == flash->model_id)
 		return 1;