diff mbox

[U-Boot,1/2] GCC4.6: Convert various empty macros to inline functions

Message ID 1316804993-29406-1-git-send-email-marek.vasut@gmail.com
State Superseded
Headers show

Commit Message

Marek Vasut Sept. 23, 2011, 7:09 p.m. UTC
Fixes problems similar to the following ones:

cmd_date.c: In function ‘do_date’:
cmd_date.c:50:6: warning: variable ‘old_bus’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
---
 common/usb.c     |    4 ++--
 include/common.h |    4 ++--
 include/i2c.h    |    5 ++++-
 3 files changed, 8 insertions(+), 5 deletions(-)

Comments

Mike Frysinger Sept. 23, 2011, 8:33 p.m. UTC | #1
On Friday, September 23, 2011 15:09:52 Marek Vasut wrote:
> --- a/include/common.h
> +++ b/include/common.h
>
> -#define debugX(level,fmt,args...)
> +static inline void debugX(const char *fmt, ...) {}

NAK:  you broke debugX()

personally i'd prefer we unify these like we did with the assert(), but this 
change is better than nothing
-mike
Marek Vasut Sept. 23, 2011, 9:52 p.m. UTC | #2
> On Friday, September 23, 2011 15:09:52 Marek Vasut wrote:
> > --- a/include/common.h
> > +++ b/include/common.h
> > 
> > -#define debugX(level,fmt,args...)
> > +static inline void debugX(const char *fmt, ...) {}
> 
> NAK:   you broke debugX()

oh, right, good catch. But is this macro even used anyway?

> 
> personally i'd prefer we unify these like we did with the assert(), but
> this   change is better than nothing
> -mike
Mike Frysinger Sept. 23, 2011, 11:04 p.m. UTC | #3
On Friday, September 23, 2011 17:52:35 Marek Vasut wrote:
> > On Friday, September 23, 2011 15:09:52 Marek Vasut wrote:
> > > --- a/include/common.h
> > > +++ b/include/common.h
> > > 
> > > -#define debugX(level,fmt,args...)
> > > +static inline void debugX(const char *fmt, ...) {}
> > 
> > NAK:   you broke debugX()
> 
> oh, right, good catch. But is this macro even used anyway?

grep says yes, a little
-mike
Marek Vasut Sept. 24, 2011, 12:40 a.m. UTC | #4
On Saturday, September 24, 2011 01:04:51 AM Mike Frysinger wrote:
> On Friday, September 23, 2011 17:52:35 Marek Vasut wrote:
> > > On Friday, September 23, 2011 15:09:52 Marek Vasut wrote:
> > > > --- a/include/common.h
> > > > +++ b/include/common.h
> > > > 
> > > > -#define debugX(level,fmt,args...)
> > > > +static inline void debugX(const char *fmt, ...) {}
> > > 
> > > NAK:   you broke debugX()
> > 
> > oh, right, good catch. But is this macro even used anyway?
> 
> grep says yes, a little
> -mike

Maybe we should just squash it and get rid of it altogether ?
Mike Frysinger Sept. 24, 2011, 5:05 a.m. UTC | #5
On Friday, September 23, 2011 20:40:25 Marek Vasut wrote:
> On Saturday, September 24, 2011 01:04:51 AM Mike Frysinger wrote:
> > On Friday, September 23, 2011 17:52:35 Marek Vasut wrote:
> > > > On Friday, September 23, 2011 15:09:52 Marek Vasut wrote:
> > > > > --- a/include/common.h
> > > > > +++ b/include/common.h
> > > > > 
> > > > > -#define debugX(level,fmt,args...)
> > > > > +static inline void debugX(const char *fmt, ...) {}
> > > > 
> > > > NAK:   you broke debugX()
> > > 
> > > oh, right, good catch. But is this macro even used anyway?
> > 
> > grep says yes, a little
> 
> Maybe we should just squash it and get rid of it altogether ?

i've rarely found a need for this sort of style of debug logging, so i 
wouldn't mind seeing it go
-mike
diff mbox

Patch

diff --git a/common/usb.c b/common/usb.c
index a401c09..a5f9e9f 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -63,7 +63,7 @@ 
 #ifdef	USB_DEBUG
 #define	USB_PRINTF(fmt, args...)	printf(fmt , ##args)
 #else
-#define USB_PRINTF(fmt, args...)
+static inline void USB_PRINTF(const char *fmt, ...) {}
 #endif
 
 #define USB_BUFSIZ	512
@@ -970,7 +970,7 @@  void usb_scan_devices(void)
 #ifdef	USB_HUB_DEBUG
 #define	USB_HUB_PRINTF(fmt, args...)	printf(fmt , ##args)
 #else
-#define USB_HUB_PRINTF(fmt, args...)
+static inline void USB_HUB_PRINTF(const char *fmt, ...) {}
 #endif
 
 
diff --git a/include/common.h b/include/common.h
index d244bd4..5c6822a 100644
--- a/include/common.h
+++ b/include/common.h
@@ -120,8 +120,8 @@  typedef volatile unsigned char	vu_char;
 #define debug(fmt,args...)	printf (fmt ,##args)
 #define debugX(level,fmt,args...) if (DEBUG>=level) printf(fmt,##args);
 #else
-#define debug(fmt,args...)
-#define debugX(level,fmt,args...)
+static inline void debug(const char *fmt, ...) {}
+static inline void debugX(const char *fmt, ...) {}
 #endif	/* DEBUG */
 
 #ifdef DEBUG
diff --git a/include/i2c.h b/include/i2c.h
index 8ceb4c8..323150d 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -55,7 +55,10 @@ 
 #else
 #define CONFIG_SYS_MAX_I2C_BUS		1
 #define I2C_GET_BUS()		0
-#define I2C_SET_BUS(a)
+static inline int I2C_SET_BUS(unsigned int bus)
+{
+	return 0;
+}
 #endif
 
 /* define the I2C bus number for RTC and DTT if not already done */