Re: [PATCH] trace: events: fix error directive in argument list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> 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



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux