[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] Building lmi with pre-wx-2.9.5 snapshot
From: |
Greg Chicares |
Subject: |
Re: [lmi] Building lmi with pre-wx-2.9.5 snapshot |
Date: |
Thu, 11 Jul 2013 23:26:06 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 |
[this crossed in the mail with yours of 2013-07-11T22:51Z;
I'll reply to that separately instead of rewriting this]
On 2013-07-11 14:06Z, Greg Chicares wrote:
[...]
> /opt/lmi/local/include/wx-2.9/wx/cpp.h:170:31: anonymous variadic macros were
> introduced in C99
> /lmi/src/lmi/workhorse.make:762: recipe for target `file_command_wx.o' failed
>
> (1) Should I...
> (1)(a) use some flag other than '-std=gnu++98' to compile lmi
> source files that include wx headers? Oops--I'm still using
> gcc-3.4.5, which supports no later standard, so '-std=c++0x'
> and '-std=c++11' are unavailable:
>
> http://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/C-Dialect-Options.html#C-Dialect-Options
For the reasons given, that can't help.
> (1)(b) attempt to disable this somehow in 'configure'? I'm
> using '--disable-vararg_macros' already, but presumably
> that's not the same thing; and my reading of 'wx/cpp.h'
> suggests that any attempted use of wxCALL_FOR_EACH would
> just produce an error if I were somehow able to turn off
> wxHAS_VARIADIC_MACROS anyway.
Actually, undefining wxHAS_VARIADIC_MACROS seems to fix the
present problem. But I would suppose that future wx versions
might tend to use wxCALL_FOR_EACH* more widely, and merely
postponing the problem isn't a solution.
> (1)(c) use '-Wno-variadic-macros' to suppress the warning
> (which is treated as an error because of '-Werror'), and
> hope^H^H^H^Htest that the compiled code just works?
Experimentation proves that that option isn't supported by
gcc-3.4.5, or by its preprocessor.
I experimentally turned off '-Werror', but that didn't help:
the warnings were still errors. And I really don't want to
turn that off anyway. For no particularly good reason, I ran
the makefile again; it compiled nothing, but produced lots of
really scary linker errors. I started writing a message about
them, but then realized that they resulted from linking old
object files that depended on wx-2.9.3, against wx-2.9.5
libraries. That happened because the failing compiler commands
produced zero-byte '.d' autodependency files, which made it
seem unnecessary to invoke the compiler on the second 'make'
pass. (BTW, lmi's 'make check_concinnity' target detects such
zero-byte files. Maybe they should be detected when building.)
This thread
http://gcc.gnu.org/ml/gcc-help/2010-10/msg00072.html
suggests turning off '-pedantic'. But I don't want to forgo
the diagnostics that would produce.
This article
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39381
suggests that installing wx's headers in gcc's system-includes
directory would prevent the error. That would have to be a
last-chance option at best. But this message
http://www.gamedev.net/topic/510702-quashing-gcc-variadic-macro-warning-in-c/
suggests we can get a similar effect by different means:
| For GCC 3, I found you can add this to the file containing the macro
definition:
| #pragma GCC system_header
| A little bit of sick came up in my mouth as I wrote it, but it does the job.
Bingo: after adding that pragma at the top of 'wx/cpp.h', lmi
compiles and links successfully, and seems to run okay (though
my testing has so far been very superficial).
That's overkill--it suppresses all warnings for that file:
http://gcc.gnu.org/onlinedocs/gcc-3.4.6/cpp/System-Headers.html#System-Headers
I tried
#ifdef wxHAS_VARIADIC_MACROS
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wvariadic-macros"
...
+ #pragma GCC diagnostic pop
#else
but got
/opt/lmi/local/include/wx-2.9/wx/cpp.h:138: warning: ignoring #pragma GCC
diagnostic
because that pragma was added in gcc-4.6 . In order to restrict
the kludge as much as possible, I moved the system_header pragma
down into the variadic-macro section:
#ifdef wxHAS_VARIADIC_MACROS
+ /* There is no other way to suppress the
+ * "anonymous variadic macros were introduced in C99"
+ * diagnostic with gcc-3.x .
+ */
+ # if defined(__GNUC__) && __GNUC__ == 3
+ # pragma GCC system_header
+ # endif /* gcc-3.x */
I suspect that's the best we'll be able to do.
I'll prepare a patch along those lines tomorrow, and post it with
an update to lmi's 'install_wx.make' so that others in our office
can test this.
Re: [lmi] Building lmi with pre-wx-2.9.5 snapshot,
Greg Chicares <=
Re: [lmi] Building lmi with pre-wx-2.9.5 snapshot, Greg Chicares, 2013/07/19