lmi
[Top][All Lists]
Advanced

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

Re: [lmi] Upgrading to gcc-4.9.2


From: Greg Chicares
Subject: Re: [lmi] Upgrading to gcc-4.9.2
Date: Sat, 19 Dec 2015 20:32:14 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.3.0

On 2015-12-19 01:44, Greg Chicares wrote:
> On 2015-12-17 15:39, Greg Chicares wrote:
> [...]
>>  -Wno-attributes
>> 
>> /lmi/src/lmi/main_common.cpp:48:25: error: ‘unsigned int 
>> _get_output_format()’ \
>> redeclared without dllimport attribute: previous dllimport ignored 
>> [-Werror=attributes]
>>  extern "C" unsigned int _get_output_format(void) {return 1;}
[...]
> +#   if defined __GNUC__ && 40600 <= LMI_GCC_VERSION
> +#       pragma GCC diagnostic push
> +#       pragma GCC diagnostic ignored "-Wattributes"
> +#   endif // defined __GNUC__ && 40600 <= LMI_GCC_VERSION
>  extern "C" unsigned int _get_output_format(void) {return 1;}
> +#   if defined __GNUC__ && 40600 <= LMI_GCC_VERSION
> +#       pragma GCC diagnostic pop
> +#   endif // defined __GNUC__ && 40600 <= LMI_GCC_VERSION

Applying that technique in these three files:
  cpp_main.cpp
  main_common.cpp
  wx_new_test.cpp
takes care of the '-Wattribute' warnings that arise from external
libraries' attributes in our normal production builds. However, using
lmi's own shared-library attributes:
  $make $coefficiency all build_type=so_test USE_SO_ATTRIBUTES=1
gives various errors like this:

In file included from /lmi/src/lmi/database_document.cpp:24:0:
/lmi/src/lmi/database_document.hpp:37:14: error: \
type attributes ignored after type is already defined [-Werror=attributes]
 class LMI_SO database_entity;

Here's the relevant part of 'database_document.hpp':

  #include "dbdict.hpp"
[...]
  class LMI_SO database_entity;

Header "dbdict.hpp" happens to include "dbvalue.hpp", which defines
  class LMI_SO database_entity
and g++4.9.2 complains when it sees a perfectly-matching forward
declaration after that definition.

I could remove the forward declaration--and it would compile, for now
at least. But I don't want to do that. It's not guaranteed to work
forever: I might make a change that makes the forward declaration
non-redundant, so removing it introduces a latent error.

Vadim, do the WXDLLIMPEXP_FWD macros work around this compiler anomaly?
I don't see how they can, but I may be missing something.

Otherwise, my options are:

- Turn off '-Wattributes', which is a bad idea.

- Turn off '-Wattributes' only with 'USE_SO_ATTRIBUTES=1', which uses
lmi's own shared-library attributes; that idea also seems bad.

- Suppress the errors locally with some goofy workaround, which is
silly, but is the least bad idea I can think of.




reply via email to

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