Re: Cross-platform "warning is an error" with Autoconf?

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

 



Hi Jeff,


On 8/3/2018 9:38 AM, Jeffrey Walton wrote:
I'm having trouble crafting an Autotools test. I'm trying to test for
the availability of Micrsoft's init_seg():

    ## This needs to be cross-platform, and not MSC specific
    CXXFLAGS="/WX"
    XXX_PROGRAM="#include <string>
       struct Bar {
          Bar(int x) : m_x(x) {}
          Bar(const Bar& o) : m_x(o.m_x) {}
          Bar& operator=(const Bar& o) {m_x=o.m_x; return *this;}
          static int s_x;
          int m_x;
       };
       #pragma init_seg(".CRT$XCU")
       int Bar::s_x = -1;
       // This should be in a separate source file violating init order.
       // The problem is, we don't know how to do it with Autotools.
       Bar f = Bar::s_x;"

The problem is, Clang, GCC, XLC, SunCC, etc issue a warning for an
unknown pragma. Detecting the warning is part of the test we need.

If I change to CXXFLAGS="-Werror" then MSC and other Windows compilers
incorrectly reject the program.

I think the root cause of the problem is, I need a cross-platform way
to say "treat warnings as error". But I don't see an
AC_WARNINGS_AS_ERRORS or similar in Autoconf.

There is an AC_LANG_WERROR, but not sure how cross-platform it is. Hopefully it parses stderror rather relying on compiler switches such as -Werror. IIRC, it worked for me when I used it, but I think one problem was that there was no way to turn off this "warnings are errors"-behaviour.

Cheers,
Peter

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://lists.gnu.org/mailman/listinfo/autoconf



[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux