Sun Studio compiler warnings - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Sun Studio compiler warnings
Date
Msg-id 4909C387.1090808@gmx.net
Whole thread Raw
Responses Re: Sun Studio compiler warnings
Re: Sun Studio compiler warnings
List pgsql-hackers
Sun Studio is producing these compiler warnings (among others):

"tsquery_op.c", line 193: warning: syntax error:  empty declaration 
"tsquery_op.c", line 194: warning: syntax error:  empty declaration 
"tsquery_op.c", line 195: warning: syntax error:  empty declaration 
"tsquery_op.c", line 196: warning: syntax error:  empty declaration 
"tsquery_op.c", line 197: warning: syntax error:  empty declaration 
"tsquery_op.c", line 198: warning: syntax error:  empty declaration

"tsvector_op.c", line 177: warning: syntax error:  empty declaration 
"tsvector_op.c", line 178: warning: syntax error:  empty declaration 
"tsvector_op.c", line 179: warning: syntax error:  empty declaration 
"tsvector_op.c", line 180: warning: syntax error:  empty declaration 
"tsvector_op.c", line 181: warning: syntax error:  empty declaration 
"tsvector_op.c", line 182: warning: syntax error:  empty declaration 
"tsvector_op.c", line 183: warning: syntax error:  empty declaration

This relates to the following sort of code:

#define CMPFUNC( NAME, CONDITION )              \
Datum                                           \
NAME(PG_FUNCTION_ARGS) {                        \    TSQuery  a = PG_GETARG_TSQUERY_COPY(0);     \    TSQuery  b =
PG_GETARG_TSQUERY_COPY(1);    \    int res = CompareTSQ(a,b);                  \
       \    PG_FREE_IF_COPY(a,0);                       \    PG_FREE_IF_COPY(b,1);                       \
                                 \    PG_RETURN_BOOL( CONDITION );                \
 
}

CMPFUNC(tsquery_lt, res < 0);
CMPFUNC(tsquery_le, res <= 0);
CMPFUNC(tsquery_eq, res == 0);
CMPFUNC(tsquery_ge, res >= 0);
CMPFUNC(tsquery_gt, res > 0);
CMPFUNC(tsquery_ne, res != 0);

The closing semicolon is strictly speaking not allowed here.  We could 
remove it, but that would probably upset pgindent?

I recall that we used to have a bunch of similar problems with the AIX 
compilers a long time ago.  Does anyone recall the solution, and do we 
still care?  (Note that it's only a warning in this case.)


pgsql-hackers by date:

Previous
From: Gregory Stark
Date:
Subject: Re: Block-level CRC checks
Next
From: Tom Lane
Date:
Subject: Re: Sun Studio compiler warnings