* Re: [PATCH] jffs2: fix sparse errors: directive in argument list [not found] <1384719513-27386-1-git-send-email-nunes.erico@gmail.com> @ 2013-11-17 21:40 ` Joe Perches 2013-11-17 22:34 ` Erico Nunes 0 siblings, 1 reply; 13+ messages in thread From: Joe Perches @ 2013-11-17 21:40 UTC (permalink / raw) To: Erico Nunes, linux-sparse; +Cc: dwmw2, linux-mtd, linux-kernel On Sun, 2013-11-17 at 18:18 -0200, Erico Nunes wrote: > This patch fixes the following errors reported when running sparse: > fs/jffs2/super.c:378:1: error: directive in argument list > fs/jffs2/super.c:380:1: error: directive in argument list > fs/jffs2/super.c:381:1: error: directive in argument list > fs/jffs2/super.c:383:1: error: directive in argument list Seems like a sparse error more than anything else. (adding sparse mailing list) Also you need to add a "Signed-off-by:" line with your email address. see: Documentation/SubmittingPatches > --- > fs/jffs2/super.c | 17 +++++++++-------- > 1 file changed, 9 insertions(+), 8 deletions(-) > > diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c > index 0defb1c..ec9e16f 100644 > --- a/fs/jffs2/super.c > +++ b/fs/jffs2/super.c > @@ -361,6 +361,14 @@ MODULE_ALIAS_FS("jffs2"); > static int __init init_jffs2_fs(void) > { > int ret; > + const char desc[] = "version 2.2." > +#ifdef CONFIG_JFFS2_FS_WRITEBUFFER > + " (NAND)" > +#endif > +#ifdef CONFIG_JFFS2_SUMMARY > + " (SUMMARY) " > +#endif > + " © 2001-2006 Red Hat, Inc."; > > /* Paranoia checks for on-medium structures. If we ask GCC > to pack them with __attribute__((packed)) then it _also_ > @@ -374,14 +382,7 @@ static int __init init_jffs2_fs(void) > BUILD_BUG_ON(sizeof(struct jffs2_raw_inode) != 68); > BUILD_BUG_ON(sizeof(struct jffs2_raw_summary) != 32); > > - pr_info("version 2.2." > -#ifdef CONFIG_JFFS2_FS_WRITEBUFFER > - " (NAND)" > -#endif > -#ifdef CONFIG_JFFS2_SUMMARY > - " (SUMMARY) " > -#endif > - " © 2001-2006 Red Hat, Inc.\n"); > + pr_info("%s\n", desc); > > jffs2_inode_cachep = kmem_cache_create("jffs2_i", > sizeof(struct jffs2_inode_info), -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] jffs2: fix sparse errors: directive in argument list 2013-11-17 21:40 ` [PATCH] jffs2: fix sparse errors: directive in argument list Joe Perches @ 2013-11-17 22:34 ` Erico Nunes 2013-11-17 22:43 ` Erico Nunes 2013-11-17 22:45 ` Joe Perches 0 siblings, 2 replies; 13+ messages in thread From: Erico Nunes @ 2013-11-17 22:34 UTC (permalink / raw) To: Joe Perches; +Cc: linux-sparse, dwmw2, linux-mtd, linux-kernel Thanks for your reply. I'll resubmit shortly. Do you mean it as an error in the sparse tool? I don't think so, I took a look and it seems to be designed to output an error for that case. On Sun, Nov 17, 2013 at 7:40 PM, Joe Perches <joe@perches.com> wrote: > On Sun, 2013-11-17 at 18:18 -0200, Erico Nunes wrote: >> This patch fixes the following errors reported when running sparse: >> fs/jffs2/super.c:378:1: error: directive in argument list >> fs/jffs2/super.c:380:1: error: directive in argument list >> fs/jffs2/super.c:381:1: error: directive in argument list >> fs/jffs2/super.c:383:1: error: directive in argument list > > Seems like a sparse error more than anything else. > (adding sparse mailing list) > > Also you need to add a "Signed-off-by:" line > with your email address. > > see: Documentation/SubmittingPatches > >> --- >> fs/jffs2/super.c | 17 +++++++++-------- >> 1 file changed, 9 insertions(+), 8 deletions(-) >> >> diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c >> index 0defb1c..ec9e16f 100644 >> --- a/fs/jffs2/super.c >> +++ b/fs/jffs2/super.c >> @@ -361,6 +361,14 @@ MODULE_ALIAS_FS("jffs2"); >> static int __init init_jffs2_fs(void) >> { >> int ret; >> + const char desc[] = "version 2.2." >> +#ifdef CONFIG_JFFS2_FS_WRITEBUFFER >> + " (NAND)" >> +#endif >> +#ifdef CONFIG_JFFS2_SUMMARY >> + " (SUMMARY) " >> +#endif >> + " © 2001-2006 Red Hat, Inc."; >> >> /* Paranoia checks for on-medium structures. If we ask GCC >> to pack them with __attribute__((packed)) then it _also_ >> @@ -374,14 +382,7 @@ static int __init init_jffs2_fs(void) >> BUILD_BUG_ON(sizeof(struct jffs2_raw_inode) != 68); >> BUILD_BUG_ON(sizeof(struct jffs2_raw_summary) != 32); >> >> - pr_info("version 2.2." >> -#ifdef CONFIG_JFFS2_FS_WRITEBUFFER >> - " (NAND)" >> -#endif >> -#ifdef CONFIG_JFFS2_SUMMARY >> - " (SUMMARY) " >> -#endif >> - " © 2001-2006 Red Hat, Inc.\n"); >> + pr_info("%s\n", desc); >> >> jffs2_inode_cachep = kmem_cache_create("jffs2_i", >> sizeof(struct jffs2_inode_info), > > > -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH] jffs2: fix sparse errors: directive in argument list 2013-11-17 22:34 ` Erico Nunes @ 2013-11-17 22:43 ` Erico Nunes 2013-11-17 22:45 ` Joe Perches 1 sibling, 0 replies; 13+ messages in thread From: Erico Nunes @ 2013-11-17 22:43 UTC (permalink / raw) To: joe; +Cc: linux-sparse, dwmw2, linux-mtd, linux-kernel, Erico Nunes This patch fixes the following errors reported when running sparse: fs/jffs2/super.c:378:1: error: directive in argument list fs/jffs2/super.c:380:1: error: directive in argument list fs/jffs2/super.c:381:1: error: directive in argument list fs/jffs2/super.c:383:1: error: directive in argument list Signed-off-by: Erico Nunes <nunes.erico@gmail.com> --- fs/jffs2/super.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 0defb1c..ec9e16f 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c @@ -361,6 +361,14 @@ MODULE_ALIAS_FS("jffs2"); static int __init init_jffs2_fs(void) { int ret; + const char desc[] = "version 2.2." +#ifdef CONFIG_JFFS2_FS_WRITEBUFFER + " (NAND)" +#endif +#ifdef CONFIG_JFFS2_SUMMARY + " (SUMMARY) " +#endif + " © 2001-2006 Red Hat, Inc."; /* Paranoia checks for on-medium structures. If we ask GCC to pack them with __attribute__((packed)) then it _also_ @@ -374,14 +382,7 @@ static int __init init_jffs2_fs(void) BUILD_BUG_ON(sizeof(struct jffs2_raw_inode) != 68); BUILD_BUG_ON(sizeof(struct jffs2_raw_summary) != 32); - pr_info("version 2.2." -#ifdef CONFIG_JFFS2_FS_WRITEBUFFER - " (NAND)" -#endif -#ifdef CONFIG_JFFS2_SUMMARY - " (SUMMARY) " -#endif - " © 2001-2006 Red Hat, Inc.\n"); + pr_info("%s\n", desc); jffs2_inode_cachep = kmem_cache_create("jffs2_i", sizeof(struct jffs2_inode_info), -- 1.8.4.2 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] jffs2: fix sparse errors: directive in argument list 2013-11-17 22:34 ` Erico Nunes 2013-11-17 22:43 ` Erico Nunes @ 2013-11-17 22:45 ` Joe Perches 2013-11-17 22:53 ` Richard Weinberger 2013-11-18 1:33 ` Al Viro 1 sibling, 2 replies; 13+ messages in thread From: Joe Perches @ 2013-11-17 22:45 UTC (permalink / raw) To: Erico Nunes; +Cc: linux-sparse, dwmw2, linux-mtd, linux-kernel On Sun, 2013-11-17 at 20:34 -0200, Erico Nunes wrote: > Do you mean it as an error in the sparse tool? Yes. I think it's a defect in how sparse treats string concatenation. That style: printk("%s\n", #ifdef FOO "foo" #endif #ifdef BAR "bar" #endif "string"); is pretty common in the kernel sources. The patch itself is otherwise fine, but perhaps unnecessary. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] jffs2: fix sparse errors: directive in argument list 2013-11-17 22:45 ` Joe Perches @ 2013-11-17 22:53 ` Richard Weinberger 2013-11-18 1:33 ` Al Viro 1 sibling, 0 replies; 13+ messages in thread From: Richard Weinberger @ 2013-11-17 22:53 UTC (permalink / raw) To: Joe Perches; +Cc: Erico Nunes, linux-mtd, linux-sparse, dwmw2, linux-kernel On Sun, Nov 17, 2013 at 11:45 PM, Joe Perches <joe@perches.com> wrote: > On Sun, 2013-11-17 at 20:34 -0200, Erico Nunes wrote: >> Do you mean it as an error in the sparse tool? > > Yes. I think it's a defect in how sparse > treats string concatenation. > > That style: > > printk("%s\n", > #ifdef FOO > "foo" > #endif > #ifdef BAR > "bar" > #endif > "string"); > > is pretty common in the kernel sources. > > The patch itself is otherwise fine, but > perhaps unnecessary. I agree with Joe, the patch fixes a non-issue. -- Thanks, //richard ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] jffs2: fix sparse errors: directive in argument list 2013-11-17 22:45 ` Joe Perches 2013-11-17 22:53 ` Richard Weinberger @ 2013-11-18 1:33 ` Al Viro 2013-11-18 2:07 ` [PATCH] Clarify error on directive in macro arguments (Re: [PATCH] jffs2: fix sparse errors: directive in argument list) Greg Price 2013-11-20 23:51 ` [PATCH] jffs2: fix sparse errors: directive in argument list Josh Triplett 1 sibling, 2 replies; 13+ messages in thread From: Al Viro @ 2013-11-18 1:33 UTC (permalink / raw) To: Joe Perches; +Cc: Erico Nunes, linux-sparse, dwmw2, linux-mtd, linux-kernel On Sun, Nov 17, 2013 at 02:45:05PM -0800, Joe Perches wrote: > On Sun, 2013-11-17 at 20:34 -0200, Erico Nunes wrote: > > Do you mean it as an error in the sparse tool? > > Yes. I think it's a defect in how sparse > treats string concatenation. > > That style: > > printk("%s\n", > #ifdef FOO > "foo" > #endif > #ifdef BAR > "bar" > #endif > "string"); > > is pretty common in the kernel sources. ... and it's perfectly fine, until somebody starts playing in nasal daemon country and do that in *macro* arguments. And a nasal daemon country it is - it's an undefined behaviour. See 6.10.3p11 in C99. And trying to define a semantics for that gets real ugly real fast. sparse matches gcc behaviour (I hope), but it warns about such abuses. It's a defect, all right - one being reported by sparse. Folks, please, RTFStandard if you decide to play clever games with preprocessing. Chapter 6.10 is not particulary long or complicated. C99 has improved the preprocessor semantics a whole lot compared to the earlier horrible mess (mostly by defining it in terms of token stream transformations rather then text ones), but it's still very easy to abuse... ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH] Clarify error on directive in macro arguments (Re: [PATCH] jffs2: fix sparse errors: directive in argument list) 2013-11-18 1:33 ` Al Viro @ 2013-11-18 2:07 ` Greg Price 2013-11-18 2:15 ` Joe Perches 2013-11-20 23:53 ` Josh Triplett 2013-11-20 23:51 ` [PATCH] jffs2: fix sparse errors: directive in argument list Josh Triplett 1 sibling, 2 replies; 13+ messages in thread From: Greg Price @ 2013-11-18 2:07 UTC (permalink / raw) To: Al Viro, Christopher Li Cc: linux-kernel, linux-sparse, linux-mtd, Joe Perches, dwmw2, Erico Nunes [+linux-sparse and Chris] On Mon, Nov 18, 2013 at 01:33:49AM +0000, Al Viro wrote: > On Sun, Nov 17, 2013 at 02:45:05PM -0800, Joe Perches wrote: > > Yes. I think it's a defect in how sparse > > treats string concatenation. > > > > That style [... with printk ...] is pretty common in the kernel sources. > > ... and it's perfectly fine, until somebody starts playing in nasal > daemon country and do that in *macro* arguments. And a nasal daemon > country it is - it's an undefined behaviour. See 6.10.3p11 in C99. > And trying to define a semantics for that gets real ugly real fast. > sparse matches gcc behaviour (I hope), but it warns about such abuses. > It's a defect, all right - one being reported by sparse. Perhaps the following tweak to the error message would make this subtlety clearer? Cheers, Greg From: Greg Price <price@mit.edu> Date: Sun, 17 Nov 2013 17:57:41 -0800 Subject: [PATCH] Clarify error on directive in macro arguments Preprocessor directives in the arguments of a real function are innocuous and in some contexts common. If a developer doesn't realize that a "function" is implemented as a macro, they may mistake this error for a false alarm. See http://www.spinics.net/lists/kernel/msg1636974.html and http://www.spinics.net/lists/kernel/msg1636976.html for an example. Easy enough to clarify that this is a macro, so do it. Signed-off-by: Greg Price <price@mit.edu> --- pre-process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pre-process.c b/pre-process.c index d521318..db58a97 100644 --- a/pre-process.c +++ b/pre-process.c @@ -204,7 +204,7 @@ static struct token *collect_arg(struct token *prev, int vararg, struct position if (next->pos.newline && match_op(next, '#')) { if (!next->pos.noexpand) { sparse_error(next->pos, - "directive in argument list"); + "directive in macro argument list"); preprocessor_line(stream, p); __free_token(next); /* Free the '#' token */ continue; -- 1.8.3.2 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] Clarify error on directive in macro arguments (Re: [PATCH] jffs2: fix sparse errors: directive in argument list) 2013-11-18 2:07 ` [PATCH] Clarify error on directive in macro arguments (Re: [PATCH] jffs2: fix sparse errors: directive in argument list) Greg Price @ 2013-11-18 2:15 ` Joe Perches 2013-11-18 2:23 ` Erico Nunes ` (2 more replies) 2013-11-20 23:53 ` Josh Triplett 1 sibling, 3 replies; 13+ messages in thread From: Joe Perches @ 2013-11-18 2:15 UTC (permalink / raw) To: Greg Price Cc: Al Viro, Christopher Li, Erico Nunes, linux-sparse, dwmw2, linux-mtd, linux-kernel On Sun, 2013-11-17 at 21:07 -0500, Greg Price wrote: > [+linux-sparse and Chris] > > On Mon, Nov 18, 2013 at 01:33:49AM +0000, Al Viro wrote: > > On Sun, Nov 17, 2013 at 02:45:05PM -0800, Joe Perches wrote: > > > Yes. I think it's a defect in how sparse > > > treats string concatenation. > > > > > > That style [... with printk ...] is pretty common in the kernel sources. > > > > ... and it's perfectly fine, until somebody starts playing in nasal > > daemon country and do that in *macro* arguments. And a nasal daemon > > country it is - it's an undefined behaviour. See 6.10.3p11 in C99. > > And trying to define a semantics for that gets real ugly real fast. > > sparse matches gcc behaviour (I hope), but it warns about such abuses. > > It's a defect, all right - one being reported by sparse. > > Perhaps the following tweak to the error message would make this > subtlety clearer? Maybe, but this case isn't a macro. It's a function. Dunno if differentiating when it's a macro or a function is difficult though. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Clarify error on directive in macro arguments (Re: [PATCH] jffs2: fix sparse errors: directive in argument list) 2013-11-18 2:15 ` Joe Perches @ 2013-11-18 2:23 ` Erico Nunes 2013-11-18 2:34 ` Al Viro 2013-11-18 4:01 ` Greg Price 2 siblings, 0 replies; 13+ messages in thread From: Erico Nunes @ 2013-11-18 2:23 UTC (permalink / raw) To: Joe Perches Cc: Greg Price, Al Viro, Christopher Li, linux-sparse, dwmw2, linux-mtd, linux-kernel On Mon, Nov 18, 2013 at 12:15 AM, Joe Perches <joe@perches.com> wrote: > On Sun, 2013-11-17 at 21:07 -0500, Greg Price wrote: > > Maybe, but this case isn't a macro. It's a function. > Dunno if differentiating when it's a macro or a > function is difficult though. > > The case which was initially reported by sparse at http://www.spinics.net/lists/kernel/msg1636974.html was using pr_info (which is a macro) and not printk. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Clarify error on directive in macro arguments (Re: [PATCH] jffs2: fix sparse errors: directive in argument list) 2013-11-18 2:15 ` Joe Perches 2013-11-18 2:23 ` Erico Nunes @ 2013-11-18 2:34 ` Al Viro 2013-11-18 4:01 ` Greg Price 2 siblings, 0 replies; 13+ messages in thread From: Al Viro @ 2013-11-18 2:34 UTC (permalink / raw) To: Joe Perches Cc: Christopher Li, linux-kernel, Greg Price, linux-sparse, linux-mtd, dwmw2, Erico Nunes On Sun, Nov 17, 2013 at 06:15:32PM -0800, Joe Perches wrote: > > > sparse matches gcc behaviour (I hope), but it warns about such abuses. > > > It's a defect, all right - one being reported by sparse. > > > > Perhaps the following tweak to the error message would make this > > subtlety clearer? > > Maybe, but this case isn't a macro. It's a function. > Dunno if differentiating when it's a macro or a > function is difficult though. In which case? With printk() it's perfectly fine and sparse will not complain at all. With pr_info(), OTOH, we have #define pr_info(fmt, ...) \ printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) and when you start playing that kind of games with it, you get warnings. ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Clarify error on directive in macro arguments (Re: [PATCH] jffs2: fix sparse errors: directive in argument list) 2013-11-18 2:15 ` Joe Perches 2013-11-18 2:23 ` Erico Nunes 2013-11-18 2:34 ` Al Viro @ 2013-11-18 4:01 ` Greg Price 2 siblings, 0 replies; 13+ messages in thread From: Greg Price @ 2013-11-18 4:01 UTC (permalink / raw) To: Joe Perches Cc: Al Viro, Christopher Li, Erico Nunes, linux-sparse, dwmw2, linux-mtd, linux-kernel On Sun, Nov 17, 2013 at 06:15:32PM -0800, Joe Perches wrote: > On Sun, 2013-11-17 at 21:07 -0500, Greg Price wrote: > > Perhaps the following tweak to the error message would make this > > subtlety clearer? > > Maybe, but this case isn't a macro. It's a function. > Dunno if differentiating when it's a macro or a > function is difficult though. Yeah, this error message is already only emitted for directives in macro arguments -- in this case, pr_info. It's in sparse's preprocessor code; the error arises when a directive is spotted while parsing a macro's arguments. By the time sparse (or an idealized C compiler) parses the arguments of a real function, the token stream is already the output of the preprocessor and any directives are gone. Cheers, Greg ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Clarify error on directive in macro arguments (Re: [PATCH] jffs2: fix sparse errors: directive in argument list) 2013-11-18 2:07 ` [PATCH] Clarify error on directive in macro arguments (Re: [PATCH] jffs2: fix sparse errors: directive in argument list) Greg Price 2013-11-18 2:15 ` Joe Perches @ 2013-11-20 23:53 ` Josh Triplett 1 sibling, 0 replies; 13+ messages in thread From: Josh Triplett @ 2013-11-20 23:53 UTC (permalink / raw) To: Greg Price Cc: Al Viro, Christopher Li, Joe Perches, Erico Nunes, linux-sparse, dwmw2, linux-mtd, linux-kernel On Sun, Nov 17, 2013 at 09:07:46PM -0500, Greg Price wrote: > From: Greg Price <price@mit.edu> > Date: Sun, 17 Nov 2013 17:57:41 -0800 > Subject: [PATCH] Clarify error on directive in macro arguments > > Preprocessor directives in the arguments of a real function > are innocuous and in some contexts common. If a developer > doesn't realize that a "function" is implemented as a macro, > they may mistake this error for a false alarm. > > See http://www.spinics.net/lists/kernel/msg1636974.html > and http://www.spinics.net/lists/kernel/msg1636976.html > for an example. > > Easy enough to clarify that this is a macro, so do it. > > Signed-off-by: Greg Price <price@mit.edu> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Good call. > pre-process.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/pre-process.c b/pre-process.c > index d521318..db58a97 100644 > --- a/pre-process.c > +++ b/pre-process.c > @@ -204,7 +204,7 @@ static struct token *collect_arg(struct token *prev, int vararg, struct position > if (next->pos.newline && match_op(next, '#')) { > if (!next->pos.noexpand) { > sparse_error(next->pos, > - "directive in argument list"); > + "directive in macro argument list"); > preprocessor_line(stream, p); > __free_token(next); /* Free the '#' token */ > continue; > -- > 1.8.3.2 > -- > To unsubscribe from this list: send the line "unsubscribe linux-sparse" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] jffs2: fix sparse errors: directive in argument list 2013-11-18 1:33 ` Al Viro 2013-11-18 2:07 ` [PATCH] Clarify error on directive in macro arguments (Re: [PATCH] jffs2: fix sparse errors: directive in argument list) Greg Price @ 2013-11-20 23:51 ` Josh Triplett 1 sibling, 0 replies; 13+ messages in thread From: Josh Triplett @ 2013-11-20 23:51 UTC (permalink / raw) To: Al Viro Cc: Joe Perches, Erico Nunes, linux-sparse, dwmw2, linux-mtd, linux-kernel On Mon, Nov 18, 2013 at 01:33:49AM +0000, Al Viro wrote: > On Sun, Nov 17, 2013 at 02:45:05PM -0800, Joe Perches wrote: > > On Sun, 2013-11-17 at 20:34 -0200, Erico Nunes wrote: > > > Do you mean it as an error in the sparse tool? > > > > Yes. I think it's a defect in how sparse > > treats string concatenation. > > > > That style: > > > > printk("%s\n", > > #ifdef FOO > > "foo" > > #endif > > #ifdef BAR > > "bar" > > #endif > > "string"); > > > > is pretty common in the kernel sources. > > ... and it's perfectly fine, until somebody starts playing in nasal > daemon country and do that in *macro* arguments. And a nasal daemon > country it is - it's an undefined behaviour. See 6.10.3p11 in C99. > And trying to define a semantics for that gets real ugly real fast. > sparse matches gcc behaviour (I hope), but it warns about such abuses. > It's a defect, all right - one being reported by sparse. > > Folks, please, RTFStandard if you decide to play clever games with > preprocessing. Chapter 6.10 is not particulary long or complicated. > C99 has improved the preprocessor semantics a whole lot compared to > the earlier horrible mess (mostly by defining it in terms of token > stream transformations rather then text ones), but it's still very > easy to abuse... And since pr_foo (and the underlying pr_fmt) are already macros, that's exactly the problem. - Josh Triplett ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2013-11-20 23:53 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <1384719513-27386-1-git-send-email-nunes.erico@gmail.com> 2013-11-17 21:40 ` [PATCH] jffs2: fix sparse errors: directive in argument list Joe Perches 2013-11-17 22:34 ` Erico Nunes 2013-11-17 22:43 ` Erico Nunes 2013-11-17 22:45 ` Joe Perches 2013-11-17 22:53 ` Richard Weinberger 2013-11-18 1:33 ` Al Viro 2013-11-18 2:07 ` [PATCH] Clarify error on directive in macro arguments (Re: [PATCH] jffs2: fix sparse errors: directive in argument list) Greg Price 2013-11-18 2:15 ` Joe Perches 2013-11-18 2:23 ` Erico Nunes 2013-11-18 2:34 ` Al Viro 2013-11-18 4:01 ` Greg Price 2013-11-20 23:53 ` Josh Triplett 2013-11-20 23:51 ` [PATCH] jffs2: fix sparse errors: directive in argument list Josh Triplett
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).