Jeffrey Walton
2018-08-02 23:38:50 UTC
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
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