autoconf
[Top][All Lists]
Advanced

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

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


From: Jeffrey Walton
Subject: Cross-platform "warning is an error" with Autoconf?
Date: Thu, 2 Aug 2018 19:38:50 -0400

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.

How do I tell Autoconf to treat warnings as errors in a cross-platform way?

Jeff



reply via email to

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