From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Hariprasad Kelam <hariprasad.kelam@gmail.com>,
mingo@redhat.com, roopa@cumulusnetworks.com, davem@davemloft.net,
linux-kernel@vger.kernel.org, linux-sparse@vger.kernel.org
Subject: Re: [PATCH] trace: events: fix error directive in argument list
Date: Sat, 30 Mar 2019 00:12:32 +0100 [thread overview]
Message-ID: <20190329231231.suwcypwnyunvysyd@ltop.local> (raw)
In-Reply-To: <20190327115330.04b5b481@gandalf.local.home>
On Wed, Mar 27, 2019 at 11:53:30AM -0400, Steven Rostedt wrote:
> On Tue, 26 Mar 2019 01:23:03 +0530
> Hariprasad Kelam <hariprasad.kelam@gmail.com> wrote:
>
> > This patch fixes below spare errors.
> >
> > Sparse error:
> > make C=2 CF=-D__CHECK_ENDIAN__ M=net/core
> > ./include/trace/events/neigh.h:73:1: error: directive in argument list
> > ./include/trace/events/neigh.h:78:1: error: directive in argument list
> > ./include/trace/events/neigh.h:150:1: error: directive in argument list
> > ./include/trace/events/neigh.h:155:1: error: directive in argument list
> >
>
> I have nothing really against these patches, but why is the current
> code considered wrong?
>
> Note, TRACE_EVENTS() are "special macros". They hold structure
> definitions and full code inside the argument list. There should be no
> reason that this is causing a warning.
The problem is that #ifdefs at line 73 & 150 are inside TRACE_EVENT()'s
invocation and this is undefined behaviour. From the standard:
... If there are sequences of preprocessing tokens within the
list of arguments that would otherwise act as preprocessing
directives, the behavior is undefined.
[C90 6.8.3, C99 & C11 6.10.3p11]
GCC can handle it (and sparse too) but yes sparse complains about it.
-- Luc Van Oostenryck
next prev parent reply other threads:[~2019-03-29 23:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-25 19:53 [PATCH] trace: events: fix error directive in argument list Hariprasad Kelam
2019-03-25 20:11 ` Steven Rostedt
2019-03-27 0:20 ` Roopa Prabhu
2019-03-27 0:19 ` Roopa Prabhu
2019-03-27 15:53 ` Steven Rostedt
2019-03-29 23:12 ` Luc Van Oostenryck [this message]
2019-03-29 23:22 ` Luc Van Oostenryck
2019-03-30 11:07 ` Hariprasad Kelam
2019-03-30 12:01 ` Luc Van Oostenryck
2019-03-30 12:40 ` Steven Rostedt
2019-03-30 13:50 ` Roopa Prabhu
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=20190329231231.suwcypwnyunvysyd@ltop.local \
--to=luc.vanoostenryck@gmail.com \
--cc=davem@davemloft.net \
--cc=hariprasad.kelam@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sparse@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=roopa@cumulusnetworks.com \
--cc=rostedt@goodmis.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).