[Monetdb-developers] [Monetdb-sql-checkins] sql/src/backends/monet5 merovingian.mx, , 1.9, 1.10

Stefan Manegold Stefan.Manegold at cwi.nl
Sun Nov 25 12:01:57 CET 2007


On Sun, Nov 25, 2007 at 11:46:46AM +0100, Fabian Groffen wrote:
> On 25-11-2007 11:38:45 +0100, Stefan Manegold wrote:
> > On Sun, Nov 25, 2007 at 10:18:26AM +0000, Fabian wrote:
> > > Update of /cvsroot/monetdb/sql/src/backends/monet5
> > > In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26685
> > > 
> > > Modified Files:
> > > 	merovingian.mx 
> > > Log Message:
> > > Attempt to fix some compiler warnings.  I cannot test myself, as I don't
> > > get them, and if I use TestWeb's CFLAGS the code doesn't compile at all
> > > at a much earlier stage.
> > 
> > "TestWeb" does not use any (particular) CFLAGS, but just the default that
> > (our) configure uses/provides (with --enable-strict, which is default for
> > the development trunk).
> > 
> > In case you have problems with this (or other) settings, please help us
> > fixing them by reporting them ans bug report.
> > 
> > The compiler warning is triggered by the following setting in lines 742,3 of
> > buildtools/conf/MonetDB.m4
> > ========
> > dnl  The default configure invocation when doing an rpmbuild also uses this
> > X_CFLAGS="$X_CFLAGS -Wp,-D_FORTIFY_SOURCE=2"
> > ========
> 
> Point is, that this is already in my X_CFLAGS, and apparently it is not
> enough.
> 
> However, the Gentoo machine (which is complaining on this topic), uses
> the following X_CFLAGS:
>  -Werror-implicit-function-declaration -Werror -Wpointer-arith
>  -Wdeclaration-after-statement -Wundef -Wp,-D_FORTIFY_SOURCE=2
> 
> And this makes it die in some bison generated code, hence I didn't file
> a bug.

That's why we also use
GCC_BISON_CFLAGS =  -Wno-undef
for bison generated code (and
GCC_SWIG_CFLAGS =  -Wno-strict-aliasing -Wno-unused-variable -Wno-unused-function -Wno-unused-parameter -Wno-undef -Wno-missing-field-initializers
for swig generated code).

Hence, try also these (or the default, i.e., w/o externally set X_CFLAGS),
and things shoudl work (or be reported as bug).

> > Some functions (system calls) do return, whether they were successful, or
> > not, and the calling ocde should check the respective return values.
> > Ignoring them via (e.g.)
> > 	(void)write(...);
> > will (most probably) not help.
> > Rather, the code should check the results, e.g.,
> > 	if (write(...) < 0) {
> > 		...
> > 	}
> > or at least pretend to do so, e.g.,
> > 	ssize_t wrt_res = 0;
> > 	wrt_res = write(...);
> > 	(void)wrt_res; /* deliberately irgnore portential errors */
> 
> Yes, but interestingly if you look at the error, it only complains about
> the 5th or so write invocation, all the earlier ones it simply appears
> to be happy about.  Its really a bit misterious to me as to why.

Hm, the error message says
=======
cc1: warnings being treated as errors
/home/monet/monet.GNU.32.32.d.777/sql/src/backends/monet5/merovingian.mx: In function ‘main’:
/home/monet/monet.GNU.32.32.d.777/sql/src/backends/monet5/merovingian.mx:1206: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
/home/monet/monet.GNU.32.32.d.777/sql/src/backends/monet5/merovingian.mx:1208: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
/home/monet/monet.GNU.32.32.d.777/sql/src/backends/monet5/merovingian.mx:1209: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
/home/monet/monet.GNU.32.32.d.777/sql/src/backends/monet5/merovingian.mx:1220: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
/home/monet/monet.GNU.32.32.d.777/sql/src/backends/monet5/merovingian.mx:1225: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
/home/monet/monet.GNU.32.32.d.777/sql/src/backends/monet5/merovingian.mx:1227: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
/home/monet/monet.GNU.32.32.d.777/sql/src/backends/monet5/merovingian.mx:1228: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
/home/monet/monet.GNU.32.32.d.777/sql/src/backends/monet5/merovingian.mx:1229: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
/home/monet/monet.GNU.32.32.d.777/sql/src/backends/monet5/merovingian.mx:1230: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
make[7]: *** [merovingian.o] Error 1
========

and `grep -n -w write sql/src/backends/monet5/merovingian.mx` says
========
571:    fout = block_stream(socket_wastream(sock, "write"));
1135:           /* write to the given file */
1151:           /* write to the given file */
1169:   /* make sure we will be able to write the our pid */
1204:                   /* oops, forking went wrong, cheat a bit in order to write to
1206:                   write(oerr, "unable to fork into background: ", 
1208:                   write(oerr, strerror(errno), strlen(strerror(errno)));
1209:                   write(oerr, "\n", 1);
1220:                           write(oerr, "another merovingian is already running\n",
1225:                           write(oerr, "unable to create .merovingian_lock file in ",
1227:                           write(oerr, dbfarm, strlen(dbfarm));
1228:                           write(oerr, ": ", 2);
1229:                           write(oerr, strerror(errno), strlen(strerror(errno)));
1230:                           write(oerr, "\n", 1);
1245:   /* write out the pid */
========

Hence, I'd say it complain about the first occurance of "write" thet is not
a srting literall or in a comment, which qualifies as the first write
invocation (in this file) for me.

Stefan

-- 
| Dr. Stefan Manegold | mailto:Stefan.Manegold at cwi.nl |
| CWI,  P.O.Box 94079 | http://www.cwi.nl/~manegold/  |
| 1090 GB Amsterdam   | Tel.: +31 (20) 592-4212       |
| The Netherlands     | Fax : +31 (20) 592-4312       |




More information about the developers-list mailing list