Hi Vincent,
Declaring a member within a struct isn't equivalent to an expression, so
the presence of just a semi-colon isn't valid ... it is supposed to be a
declaration (consisting of a type and member name).
Individual warnings and errors can be turned off, if desired, by using
the -erroff flag along with the message tag of interest. A warning/error
tag name can be found by specifying the -errtags flag. Once you have the
tag name, you can compile your source with the -erroff flag
(-erroff=<message tag name>). In this case, if you specify -errtags,
you'll find the message tag name is
E_EMPTY_MBR_DECLARATION
Compiling with -erroff=E_EMPTY_MBR_DECLARATION will inhibit generation
of the empty member declaration warning.
--Dave
Vincent Torri wrote:
>
> Hey,
>
> In a header file, we define a macro if pthread is available at configure
> time, like that:
>
> #ifdef HAVE_PTHREAD
> # define LK(x) pthread_mutex_t x
> #else
> # defne LK(x)
> #endif
>
> When we use it, for example in a structure:
>
> struct foo
> {
> int i;
> LK(lock);
> };
>
> So, when pthread support is disabled, we have
>
> struct foo
> {
> int i;
> ;
> };
>
> and suncc reports the warning:
>
> warning: syntax error: empty member declaration
>
> One solution would be to put the ; inside the define, and remove the ; in
> the structure. But then editors are completly lost when indenting the
> source code.
>
> it seems to me that empty declarations are allowed (a semicolon is a valid
> empty statement). Am I wrong ? And is there a compiler option to remove
> the warning ?
>
> Vincent Torri
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> tools-compilers mailing list
> tools-compilers at opensolaris.org
>