octave-maintainers
[Top][All Lists]
Advanced

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

RE: return code of mkoctfile


From: Rik
Subject: RE: return code of mkoctfile
Date: Wed, 04 Jun 2014 08:07:34 -0700

On 06/04/2014 05:58 AM, address@hidden wrote:
> From: Andreas Weber <address@hidden>
> To: address@hidden
> Subject: mkoctfile exits with 0 if gcc failed
> Message-ID: <address@hidden>
> Content-Type: text/plain; charset=windows-1252
>
> Dear maintainers,
>
> mkoctfile returns 0 if the called subprocess returns != 0.
>
> One example:
> ~/src/octave-src$ LC_ALL=C mkoctfile nonexistentfile.cpp
> g++: error: nonexistentfile.cpp: No such file or directory
> g++: fatal error: no input files
> compilation terminated.
> g++: error: nonexistentfile.o: No such file or directory
> ~/src/octave-src$ echo $?
> 0
>
> This is because system returns the exit status of the called process in
> the upper 8bits. According to "man wait" WIFEXITED and WEXITSTSTUS
> should be used for the bit shifting and masking stuff.
>
> I propose the following patch:
>
> diff -r 0ede4dbb37f1 src/mkoctfile.in.cc
> --- a/src/mkoctfile.in.cc       Sun Mar 30 14:18:43 2014 -0700
> +++ b/src/mkoctfile.in.cc       Wed Jun 04 14:42:58 2014 +0200
> @@ -344,7 +344,10 @@
>  {
>    if (debug)
>      std::cout << cmd << std::endl;
> -  return system (cmd.c_str ());
> +  int result = system (cmd.c_str ());
> +  if (WIFEXITED (result))
> +    result = WEXITSTATUS (result);
> +  return result;
>  }

This looks like a reasonable change.  Could you file a bug report about it
and convert the diff to a Mercurial changeset?

>
>
> which works but I get the following warnings when compiling mkoctfile on
> debian wheezy 64bit with gcc 4.7.2:
> mkoctfile.cc: In function ?int run_command(const string&)?:
> mkoctfile.cc:348:7: warning: use of old-style cast [-Wold-style-cast]
> mkoctfile.cc:349:14: warning: use of old-style cast [-Wold-style-cast]
>
>
> The old style cast is defined in /usr/include/stdlib.h:55
> #ifdef __USE_BSD
> .....
> #define __WAIT_INT(status)    (*(int *) &(status))
>
> Any hints what should be done to avoid these warnings?

This is a general problem in the GNU build system in that it has per-target
compilation options but not per-object compilation options.  If you do a
fresh build you will see that the compilation produces the same old-style
cast warning several times for pieces of code in the Qhull library and in
sighandlers.cc.

In this case, however, mkoctfile is it's own target in src/Makefile.am so
we can do something about it.  Try adding the following line to src/Makefile.am

mkoctfile_CXXFLAGS = $(filter-out -Wold-style-cast, $(AM_CXXFLAGS))

--Rik




reply via email to

[Prev in Thread] Current Thread [Next in Thread]