* Re: FW: 2.5.34: IR __FUNCTION__ breakage
[not found] <MNEMKBGMDIMHCBHPHLGPMEEDDDAA.dag@brattli.net>
@ 2002-09-20 17:13 ` Jean Tourrilhes
2002-09-20 17:17 ` Jeff Garzik
2002-09-20 17:25 ` Thunder from the hill
0 siblings, 2 replies; 7+ messages in thread
From: Jean Tourrilhes @ 2002-09-20 17:13 UTC (permalink / raw)
To: thunder, linux-kernel
On Fri, Sep 13, 2002 at 08:25:50AM +0200, Dag Brattli wrote:
> -----Original Message-----
> From: Thunder from the hill [mailto:thunder@lightweight.ods.org]
> Sent: 12. september 2002 22:17
> To: Bob_Tracy
> Cc: dag@brattli.net; linux-kernel@vger.kernel.org
> Subject: Re: 2.5.34: IR __FUNCTION__ breakage
>
>
> Hi,
>
> On Thu, 12 Sep 2002, Bob_Tracy wrote:
> > define DERROR(dbg, args...) \
> > {if(DEBUG_##dbg){\
> > printk(KERN_INFO "irnet: %s(): ", __FUNCTION__);\
> > printk(KERN_INFO args);}}
> >
> > which strikes me as not quite what the author intended, although it
> > should work.
>
> Why not
>
> #define DERROR(dbg, fmt, args...) \
> do { if (DEBUG_##dbg) \
> printk(KERN_INFO "irnet: %s(): " fmt, __FUNCTION, args); \
> } while(0)
>
> ?
>
> Thunder
Try it, it won't work when there is zero args.
Jean
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: FW: 2.5.34: IR __FUNCTION__ breakage
2002-09-20 17:13 ` FW: 2.5.34: IR __FUNCTION__ breakage Jean Tourrilhes
@ 2002-09-20 17:17 ` Jeff Garzik
2002-09-20 17:19 ` Jean Tourrilhes
2002-09-20 17:25 ` Thunder from the hill
1 sibling, 1 reply; 7+ messages in thread
From: Jeff Garzik @ 2002-09-20 17:17 UTC (permalink / raw)
To: jt; +Cc: thunder, linux-kernel
Jean Tourrilhes wrote:
> On Fri, Sep 13, 2002 at 08:25:50AM +0200, Dag Brattli wrote:
>
>>-----Original Message-----
>>From: Thunder from the hill [mailto:thunder@lightweight.ods.org]
>>Sent: 12. september 2002 22:17
>>To: Bob_Tracy
>>Cc: dag@brattli.net; linux-kernel@vger.kernel.org
>>Subject: Re: 2.5.34: IR __FUNCTION__ breakage
>>
>>
>>Hi,
>>
>>On Thu, 12 Sep 2002, Bob_Tracy wrote:
>>
>>>define DERROR(dbg, args...) \
>>> {if(DEBUG_##dbg){\
>>> printk(KERN_INFO "irnet: %s(): ", __FUNCTION__);\
>>> printk(KERN_INFO args);}}
>>>
>>>which strikes me as not quite what the author intended, although it
>>>should work.
>>
>>Why not
>>
>>#define DERROR(dbg, fmt, args...) \
>> do { if (DEBUG_##dbg) \
>> printk(KERN_INFO "irnet: %s(): " fmt, __FUNCTION, args); \
>> } while(0)
>>
>>?
>>
>> Thunder
>
>
> Try it, it won't work when there is zero args.
I fixed up a bunch of these __FUNCTION__ breakage, you can grab them
from 2.5.37 (just released)
Also, specifically relating to varargs macros as described above, you
can certainly have a varargs macro with zero args, just look at C99
varargs macros...
Jeff
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: FW: 2.5.34: IR __FUNCTION__ breakage
2002-09-20 17:17 ` Jeff Garzik
@ 2002-09-20 17:19 ` Jean Tourrilhes
2002-09-20 18:10 ` Bjoern A. Zeeb
0 siblings, 1 reply; 7+ messages in thread
From: Jean Tourrilhes @ 2002-09-20 17:19 UTC (permalink / raw)
To: Jeff Garzik; +Cc: jt, thunder, linux-kernel
On Fri, Sep 20, 2002 at 01:17:01PM -0400, Jeff Garzik wrote:
>
> I fixed up a bunch of these __FUNCTION__ breakage, you can grab them
> from 2.5.37 (just released)
I'll catch up with my e-mail and I'll look at that.
> Also, specifically relating to varargs macros as described above, you
> can certainly have a varargs macro with zero args, just look at C99
> varargs macros...
I remember that it didn't work. Ok, I'll try again.
> Jeff
Have fun...
Jean
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: FW: 2.5.34: IR __FUNCTION__ breakage
2002-09-20 17:13 ` FW: 2.5.34: IR __FUNCTION__ breakage Jean Tourrilhes
2002-09-20 17:17 ` Jeff Garzik
@ 2002-09-20 17:25 ` Thunder from the hill
1 sibling, 0 replies; 7+ messages in thread
From: Thunder from the hill @ 2002-09-20 17:25 UTC (permalink / raw)
To: Jean Tourrilhes; +Cc: thunder, Linux Kernel Mailing List
Hi,
On Fri, 20 Sep 2002, Jean Tourrilhes wrote:
> > Why not
> >
> > #define DERROR(dbg, fmt, args...) \
> > do { if (DEBUG_##dbg) \
> > printk(KERN_INFO "irnet: %s(): " fmt, __FUNCTION, args); \
> > } while(0)
> >
> > ?
> >
> > Thunder
>
> Try it, it won't work when there is zero args.
It got corrected shortly afterwards. The non-typo version is:
#define DERROR(dbg, fmt, args...) \
do { if(DEBUG_##dbg) \
printk(KERN_INFO "irnet: %s(): " fmt, __FUNCTION__, ##args); \
} while(0)
Example:
#define DEBUG(fmt, args...) \
printf("%s(): " fmt, __FUNCTION__, ## args)
int main(void)
{
DEBUG("I am hungry.\n");
exit(0);
}
# gcc -Wall -Os -o moehre -s moehre.c
# ./moehre
main(): I am hungry.
#
Thunder
--
assert(typeof((fool)->next) == typeof(fool)); /* wrong */
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: FW: 2.5.34: IR __FUNCTION__ breakage
2002-09-20 17:19 ` Jean Tourrilhes
@ 2002-09-20 18:10 ` Bjoern A. Zeeb
2002-09-20 21:41 ` Neil Booth
0 siblings, 1 reply; 7+ messages in thread
From: Bjoern A. Zeeb @ 2002-09-20 18:10 UTC (permalink / raw)
To: jt; +Cc: Jeff Garzik, thunder, linux-kernel
On Fri, 20 Sep 2002, Jean Tourrilhes wrote:
Hi,
> > Also, specifically relating to varargs macros as described above, you
> > can certainly have a varargs macro with zero args, just look at C99
> > varargs macros...
>
> I remember that it didn't work. Ok, I'll try again.
if I remember corretly with C99 if you do s.th. like this (simple
sample):
#define LOG(level, format, ...) \
log(level, format, ##__VA_ARGS__);
you _need_ to give an argument:
LOG(debug, "blah", 0);
w/o the ", 0" this is an error.
There have been gcc extentions that allow(ed) zero arguments.
*searching*
See: http://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html
--
Bjoern A. Zeeb bzeeb at Zabbadoz dot NeT
56 69 73 69 74 http://www.zabbadoz.net/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: FW: 2.5.34: IR __FUNCTION__ breakage
2002-09-20 18:10 ` Bjoern A. Zeeb
@ 2002-09-20 21:41 ` Neil Booth
2002-09-20 22:11 ` Jean Tourrilhes
0 siblings, 1 reply; 7+ messages in thread
From: Neil Booth @ 2002-09-20 21:41 UTC (permalink / raw)
To: Bjoern A. Zeeb; +Cc: jt, Jeff Garzik, thunder, linux-kernel
Bjoern A. Zeeb wrote:-
> > > Also, specifically relating to varargs macros as described above, you
> > > can certainly have a varargs macro with zero args, just look at C99
> > > varargs macros...
> >
> > I remember that it didn't work. Ok, I'll try again.
>
> if I remember corretly with C99 if you do s.th. like this (simple
> sample):
>
> #define LOG(level, format, ...) \
> log(level, format, ##__VA_ARGS__);
No, this is only valid C99 if __VA_ARGS__ is the empty list.
I posted the correct way to write this macro about a week ago that
works with all versions of GCC (and follows their documented
behaviour; this stuff *is* all documented).
Neil.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: FW: 2.5.34: IR __FUNCTION__ breakage
2002-09-20 21:41 ` Neil Booth
@ 2002-09-20 22:11 ` Jean Tourrilhes
0 siblings, 0 replies; 7+ messages in thread
From: Jean Tourrilhes @ 2002-09-20 22:11 UTC (permalink / raw)
To: Neil Booth; +Cc: Bjoern A. Zeeb, jt, Jeff Garzik, thunder, linux-kernel
On Fri, Sep 20, 2002 at 10:41:38PM +0100, Neil Booth wrote:
> Bjoern A. Zeeb wrote:-
>
> > > > Also, specifically relating to varargs macros as described above, you
> > > > can certainly have a varargs macro with zero args, just look at C99
> > > > varargs macros...
> > >
> > > I remember that it didn't work. Ok, I'll try again.
> >
> > if I remember corretly with C99 if you do s.th. like this (simple
> > sample):
> >
> > #define LOG(level, format, ...) \
> > log(level, format, ##__VA_ARGS__);
>
> No, this is only valid C99 if __VA_ARGS__ is the empty list.
>
> I posted the correct way to write this macro about a week ago that
> works with all versions of GCC (and follows their documented
> behaviour; this stuff *is* all documented).
>
> Neil.
Err... Can you point me to your post ?
Jean
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2002-09-20 22:06 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <MNEMKBGMDIMHCBHPHLGPMEEDDDAA.dag@brattli.net>
2002-09-20 17:13 ` FW: 2.5.34: IR __FUNCTION__ breakage Jean Tourrilhes
2002-09-20 17:17 ` Jeff Garzik
2002-09-20 17:19 ` Jean Tourrilhes
2002-09-20 18:10 ` Bjoern A. Zeeb
2002-09-20 21:41 ` Neil Booth
2002-09-20 22:11 ` Jean Tourrilhes
2002-09-20 17:25 ` Thunder from the hill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox