summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-06-30 19:30:49 -0700
committerBen Longbons <b.r.longbons@gmail.com>2014-06-30 20:57:13 -0700
commitaa4df026d44bd205f8bfce8a3b8d6a1144332f32 (patch)
tree397692da57b2be8f7c083989ed37fb03308d5b2c
parent7c5c2058e9aea996dc6c76a7e6d9ba4fc2a2bc77 (diff)
downloadtmwa-aa4df026d44bd205f8bfce8a3b8d6a1144332f32.tar.gz
tmwa-aa4df026d44bd205f8bfce8a3b8d6a1144332f32.tar.bz2
tmwa-aa4df026d44bd205f8bfce8a3b8d6a1144332f32.tar.xz
tmwa-aa4df026d44bd205f8bfce8a3b8d6a1144332f32.zip
Finally get around to decoupling the warning system
-rwxr-xr-xeathena.sh54
-rw-r--r--src/admin/ladmin.cpp6
-rw-r--r--src/compat/iter_test.cpp2
-rw-r--r--src/generic/array_test.cpp2
-rw-r--r--src/generic/intern-pool_test.cpp2
-rw-r--r--src/generic/md5_test.cpp2
-rw-r--r--src/generic/oops_test.cpp4
-rw-r--r--src/ints/cmp.hpp6
-rw-r--r--src/ints/cmp_test.cpp2
-rw-r--r--src/ints/udl_test.cpp7
-rw-r--r--src/io/cxxstdio.hpp8
-rw-r--r--src/io/fd.hpp18
-rw-r--r--src/io/line_test.cpp2
-rw-r--r--src/io/read_test.cpp2
-rw-r--r--src/io/write_test.cpp2
-rw-r--r--src/login/login.cpp6
-rw-r--r--src/map/battle.cpp12
-rw-r--r--src/map/magic-interpreter-base.cpp6
-rw-r--r--src/mmo/core.cpp30
-rw-r--r--src/mmo/extract_test.cpp2
-rw-r--r--src/mmo/human_time_diff_test.cpp2
-rw-r--r--src/monitor/main.cpp14
-rw-r--r--src/net/ip_test.cpp2
-rw-r--r--src/net/socket.cpp26
-rw-r--r--src/range/slice_test.cpp2
-rw-r--r--src/sexpr/lexer_test.cpp2
-rw-r--r--src/sexpr/parser_test.cpp2
-rw-r--r--src/sexpr/variant_test.cpp2
-rw-r--r--src/sexpr/void.hpp2
-rw-r--r--src/strings/base_test.cpp3
-rw-r--r--src/strings/strings2_test.cpp2
-rw-r--r--src/strings/strings_test.cpp2
-rw-r--r--src/warning_list.hpp1256
-rw-r--r--src/warnings.hpp901
34 files changed, 1477 insertions, 916 deletions
diff --git a/eathena.sh b/eathena.sh
deleted file mode 100755
index 98384e5..0000000
--- a/eathena.sh
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/bash
-
-# $Id: eathena.sh,v 1.5 2006/03/10 21:41:09 Platyna Exp $
-#----------------------------------------------------------------------
-# Description: Simple script to control eAthena locally.
-# Author: Zuzanna K. Filutowska <platyna@platinum.linux.pl>
-# Created at: Fri Feb 17 18:23:56 CET 2006
-# License: GPL
-# Copyright (c) 2006 Zuzanna K. Filutowska All rights reserved.
-#
-#----------------------------------------------------------------------
-# Configure section:
-PATH=$PATH:.
-SRVHOMEDIR=$HOME/tmwserver
-#----------------------------------------------------------------------
-# main()
-
-ulimit -u 10
-
-cd ${SRVHOMEDIR}
-
-eathena_start() {
- if [ -x ${SRVHOMEDIR}/eathena-monitor ];
- then echo "Starting eathena monitor..."
- ${SRVHOMEDIR}/eathena-monitor ${SRVHOMEDIR}/conf/eathena-monitor.conf
- else echo "Eathena monitor binary is not executable or not found."
- fi
-}
-
-eathena_stop() {
- echo "Shutting down eathena monitor..."
- killall eathena-monitor
-}
-
-eathena_restart() {
- eathena_stop
- echo "Waiting for all eathena processes to end..."
- sleep 1
- eathena_start
-}
-
-case "$1" in
-'start')
- eathena_start
- ;;
-'stop')
- eathena_stop
- ;;
-'restart')
- eathena_restart
- ;;
-*)
- echo "usage $0 start|stop|restart"
-esac
diff --git a/src/admin/ladmin.cpp b/src/admin/ladmin.cpp
index fdd64f3..9dae089 100644
--- a/src/admin/ladmin.cpp
+++ b/src/admin/ladmin.cpp
@@ -272,13 +272,13 @@ int list_type, list_count; // parameter to display a list of accounts
static
int already_exit_function = 0; // sometimes, the exit function is called twice... so, don't log twice the message
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wmissing-noreturn"
+DIAG_PUSH();
+DIAG_I(missing_noreturn);
void SessionDeleter::operator()(SessionData *)
{
assert(false && "ladmin does not have sessions"_s);
}
-#pragma GCC diagnostic pop
+DIAG_POP();
//------------------------------
// Writing function of logs file
diff --git a/src/compat/iter_test.cpp b/src/compat/iter_test.cpp
index 71cc891..6732c47 100644
--- a/src/compat/iter_test.cpp
+++ b/src/compat/iter_test.cpp
@@ -29,8 +29,6 @@
namespace tmwa
{
-#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
-
TEST(iterpair, strings)
{
IteratorPair<ValueIterator<char>> pair = value_range('0', ':');
diff --git a/src/generic/array_test.cpp b/src/generic/array_test.cpp
index eb31523..aff47ee 100644
--- a/src/generic/array_test.cpp
+++ b/src/generic/array_test.cpp
@@ -25,8 +25,6 @@
namespace tmwa
{
-#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
-
TEST(Array, simple)
{
GenericArray<int, SimpleIndexing<3>> a;
diff --git a/src/generic/intern-pool_test.cpp b/src/generic/intern-pool_test.cpp
index 5858031..c91be91 100644
--- a/src/generic/intern-pool_test.cpp
+++ b/src/generic/intern-pool_test.cpp
@@ -27,8 +27,6 @@
namespace tmwa
{
-#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
-
TEST(InternPool, whydoesthisalwaysneedasecondname)
{
InternPool p;
diff --git a/src/generic/md5_test.cpp b/src/generic/md5_test.cpp
index 929e94f..86cbd53 100644
--- a/src/generic/md5_test.cpp
+++ b/src/generic/md5_test.cpp
@@ -28,8 +28,6 @@
namespace tmwa
{
-#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
-
// This should be made part of the main API,
// but is not yet to keep the diff small.
// Edit: hack to fix the new strict comparison.
diff --git a/src/generic/oops_test.cpp b/src/generic/oops_test.cpp
index e1a5381..11c87e7 100644
--- a/src/generic/oops_test.cpp
+++ b/src/generic/oops_test.cpp
@@ -25,8 +25,6 @@
namespace tmwa
{
-#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
-
TEST(oops, okay)
{
try
@@ -50,7 +48,7 @@ TEST(oops, uhoh)
catch (const AssertionError& e)
{
ASSERT_STREQ(strstr(e.what(), "src/generic/"),
- "src/generic/oops_test.cpp:47: error: in 'virtual void tmwa::oops_uhoh_Test::TestBody()', incorrectly alleged that 'the sky is falling' (1 == 0)");
+ "src/generic/oops_test.cpp:45: error: in 'virtual void tmwa::oops_uhoh_Test::TestBody()', incorrectly alleged that 'the sky is falling' (1 == 0)");
}
}
} // namespace tmwa
diff --git a/src/ints/cmp.hpp b/src/ints/cmp.hpp
index 16384e6..58a33b4 100644
--- a/src/ints/cmp.hpp
+++ b/src/ints/cmp.hpp
@@ -27,8 +27,8 @@ namespace tmwa
{
namespace ints
{
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wtype-limits"
+ DIAG_PUSH();
+ DIAG_I(type_limits);
template<class T, class U>
T saturate(const U& v)
{
@@ -62,7 +62,7 @@ namespace ints
return v;
}
}
-#pragma GCC diagnostic pop
+ DIAG_POP();
} // namespace ints
using ints::saturate;
diff --git a/src/ints/cmp_test.cpp b/src/ints/cmp_test.cpp
index be99544..5c605c0 100644
--- a/src/ints/cmp_test.cpp
+++ b/src/ints/cmp_test.cpp
@@ -27,8 +27,6 @@
namespace tmwa
{
-#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
-
// Google Test is *really* slow to compile this file
#undef EXPECT_EQ
#define EXPECT_EQ(a, b) assert(a == b)
diff --git a/src/ints/udl_test.cpp b/src/ints/udl_test.cpp
index b3ad30d..3fa9c31 100644
--- a/src/ints/udl_test.cpp
+++ b/src/ints/udl_test.cpp
@@ -27,10 +27,9 @@
namespace tmwa
{
-#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
+DIAG_PUSH();
+DIAG_I(unused_variable);
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wunused-variable"
TEST(ints, smc)
{
{
@@ -476,7 +475,7 @@ TEST(ints, smc)
//ints::SignedMagnitudeConstant<true, 0x10000000000000000> i;
}
}
-#pragma GCC diagnostic pop
+DIAG_POP();
TEST(ints, constant)
{
diff --git a/src/io/cxxstdio.hpp b/src/io/cxxstdio.hpp
index 66c2aa8..a8343c0 100644
--- a/src/io/cxxstdio.hpp
+++ b/src/io/cxxstdio.hpp
@@ -131,11 +131,13 @@ namespace cxxstdio
{}
~EnumConverter()
{
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wtype-limits"
+ DIAG_PUSH();
+ DIAG_I(type_limits);
if (min_value <= mid && mid <= max_value)
-#pragma GCC diagnostic pop
+ {
+ DIAG_POP();
out = E(mid);
+ }
}
U *operator &()
{
diff --git a/src/io/fd.hpp b/src/io/fd.hpp
index d725c8a..f1d1751 100644
--- a/src/io/fd.hpp
+++ b/src/io/fd.hpp
@@ -137,24 +137,24 @@ namespace io
}
void clr(FD fd)
{
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wold-style-cast"
+ DIAG_PUSH();
+ DIAG_I(old_style_cast);
FD_CLR(fd.uncast_dammit(), &fds);
-#pragma GCC diagnostic pop
+ DIAG_POP();
}
bool isset(FD fd)
{
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wold-style-cast"
+ DIAG_PUSH();
+ DIAG_I(old_style_cast);
return FD_ISSET(fd.uncast_dammit(), &fds);
-#pragma GCC diagnostic pop
+ DIAG_POP();
}
void set(FD fd)
{
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wold-style-cast"
+ DIAG_PUSH();
+ DIAG_I(old_style_cast);
FD_SET(fd.uncast_dammit(), &fds);
-#pragma GCC diagnostic pop
+ DIAG_POP();
}
static
diff --git a/src/io/line_test.cpp b/src/io/line_test.cpp
index 9f04bf8..edf60bd 100644
--- a/src/io/line_test.cpp
+++ b/src/io/line_test.cpp
@@ -28,8 +28,6 @@
namespace tmwa
{
-#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
-
static
io::FD string_pipe(ZString sz)
{
diff --git a/src/io/read_test.cpp b/src/io/read_test.cpp
index 6fc1563..8fe84b7 100644
--- a/src/io/read_test.cpp
+++ b/src/io/read_test.cpp
@@ -29,8 +29,6 @@
namespace tmwa
{
-#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
-
static
io::FD string_pipe(ZString sz)
{
diff --git a/src/io/write_test.cpp b/src/io/write_test.cpp
index 7219c4b..2347e7e 100644
--- a/src/io/write_test.cpp
+++ b/src/io/write_test.cpp
@@ -33,8 +33,6 @@
namespace tmwa
{
-#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
-
static
io::FD pipew(io::FD& rfd)
{
diff --git a/src/login/login.cpp b/src/login/login.cpp
index 1d6b909..ccb68fc 100644
--- a/src/login/login.cpp
+++ b/src/login/login.cpp
@@ -178,13 +178,13 @@ int start_limited_time = -1; // Starting additional sec from now for the limit
static
int check_ip_flag = 1; // It's to check IP of a player between login-server and char-server (part of anti-hacking system)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wmissing-noreturn"
+DIAG_PUSH();
+DIAG_I(missing_noreturn);
void SessionDeleter::operator()(SessionData *)
{
assert(false && "login server does not have sessions anymore"_s);
}
-#pragma GCC diagnostic pop
+DIAG_POP();
constexpr int AUTH_FIFO_SIZE = 256;
struct AuthFifo
diff --git a/src/map/battle.cpp b/src/map/battle.cpp
index c0459a7..eabe8a6 100644
--- a/src/map/battle.cpp
+++ b/src/map/battle.cpp
@@ -51,10 +51,10 @@ namespace tmwa
{
static Battle_Config init_battle_config();
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wshadow"
+DIAG_PUSH();
+DIAG_I(shadow);
struct Battle_Config battle_config = init_battle_config();
-#pragma GCC diagnostic pop
+DIAG_POP();
/*==========================================
* 自分をロックしている対象の数を返す(汎用)
@@ -2312,10 +2312,10 @@ int battle_check_range(dumb_ptr<block_list> src, dumb_ptr<block_list> bl,
Battle_Config init_battle_config()
{
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wshadow"
+ DIAG_PUSH();
+ DIAG_I(shadow);
Battle_Config battle_config;
-#pragma GCC diagnostic pop
+ DIAG_POP();
{
battle_config.warp_point_debug = 0;
battle_config.enemy_critical = 0;
diff --git a/src/map/magic-interpreter-base.cpp b/src/map/magic-interpreter-base.cpp
index fa53c51..768a7df 100644
--- a/src/map/magic-interpreter-base.cpp
+++ b/src/map/magic-interpreter-base.cpp
@@ -46,8 +46,8 @@ void set_int_p(val_t *v, int i, TYPE t)
}
#warning "This code should die"
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wunused-macros"
+DIAG_PUSH();
+DIAG_I(unused_macros);
#define set_int(v, i) set_int_p(v, i, TYPE::INT)
#define set_dir(v, i) set_int_p(v, i, TYPE::DIR)
@@ -85,7 +85,7 @@ void set_spell SETTER(dumb_ptr<spell_t>, TYPE::SPELL, v_spell)
#define set_env_invocation(v, x) setenv(set_invocation, v, x)
#define set_env_spell(v, x) setenv(set_spell, v, x)
-#pragma GCC diagnostic pop
+DIAG_POP();
magic_conf_t magic_conf; /* Global magic conf */
env_t magic_default_env = { &magic_conf, nullptr };
diff --git a/src/mmo/core.cpp b/src/mmo/core.cpp
index 444a44c..2264ec6 100644
--- a/src/mmo/core.cpp
+++ b/src/mmo/core.cpp
@@ -62,10 +62,12 @@ sigfunc compat_signal(int signo, sigfunc func)
sact.sa_flags = 0;
if (sigaction(signo, &sact, &oact) < 0)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wold-style-cast"
+ {
+ DIAG_PUSH();
+ DIAG_I(old_style_cast);
return SIG_ERR;
-#pragma GCC diagnostic pop
+ DIAG_POP();
+ }
return oact.sa_handler;
}
@@ -82,10 +84,12 @@ static
void sig_proc(int)
{
for (int i = 1; i < 31; ++i)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wold-style-cast"
+ {
+ DIAG_PUSH();
+ DIAG_I(old_style_cast);
compat_signal(i, SIG_IGN);
-#pragma GCC diagnostic pop
+ DIAG_POP();
+ }
runflag = false;
}
@@ -117,24 +121,24 @@ int main(int argc, char **argv)
// set up exit handlers *after* the initialization has happened.
// This is because term_func is likely to depend on successful init.
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wold-style-cast"
+ DIAG_PUSH();
+ DIAG_I(old_style_cast);
compat_signal(SIGPIPE, SIG_IGN);
-#pragma GCC diagnostic pop
+ DIAG_POP();
compat_signal(SIGTERM, sig_proc);
compat_signal(SIGINT, sig_proc);
compat_signal(SIGCHLD, chld_proc);
// Signal to create coredumps by system when necessary (crash)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wold-style-cast"
-#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
+ DIAG_PUSH();
+ DIAG_I(old_style_cast);
+ DIAG_I(zero_as_null_pointer_constant);
compat_signal(SIGSEGV, SIG_DFL);
compat_signal(SIGBUS, SIG_DFL);
compat_signal(SIGTRAP, SIG_DFL);
compat_signal(SIGILL, SIG_DFL);
compat_signal(SIGFPE, SIG_DFL);
-#pragma GCC diagnostic pop
+ DIAG_POP();
atexit(term_func);
diff --git a/src/mmo/extract_test.cpp b/src/mmo/extract_test.cpp
index 0116f6c..e6dc7b2 100644
--- a/src/mmo/extract_test.cpp
+++ b/src/mmo/extract_test.cpp
@@ -29,8 +29,6 @@
namespace tmwa
{
-#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
-
TEST(extract, record_int)
{
int x, y, z;
diff --git a/src/mmo/human_time_diff_test.cpp b/src/mmo/human_time_diff_test.cpp
index 590e2b3..c18599d 100644
--- a/src/mmo/human_time_diff_test.cpp
+++ b/src/mmo/human_time_diff_test.cpp
@@ -25,8 +25,6 @@
namespace tmwa
{
-#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
-
// a sequence of [-+]?[0-9]+([ay]|m|[jd]|h|mn|s)
TEST(humantimediff, single)
diff --git a/src/monitor/main.cpp b/src/monitor/main.cpp
index 5d7478d..ec1139a 100644
--- a/src/monitor/main.cpp
+++ b/src/monitor/main.cpp
@@ -140,10 +140,10 @@ pid_t start_process(ZString exec)
}
if (pid == 0)
{
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wcast-qual"
+ DIAG_PUSH();
+ DIAG_I(cast_qual);
execv(exec.c_str(), const_cast<char **>(args));
-#pragma GCC diagnostic pop
+ DIAG_POP();
perror("Failed to exec");
kill(getppid(), SIGABRT);
exit(1);
@@ -161,11 +161,11 @@ void stop_process(int sig)
kill(pid_login, sig);
if (pid_char)
kill(pid_char, sig);
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wold-style-cast"
-#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
+ DIAG_PUSH();
+ DIAG_I(old_style_cast);
+ DIAG_I(zero_as_null_pointer_constant);
signal(sig, SIG_DFL);
-#pragma GCC diagnostic pop
+ DIAG_POP();
raise(sig);
}
} // namespace tmwa
diff --git a/src/net/ip_test.cpp b/src/net/ip_test.cpp
index c2095ee..419dc03 100644
--- a/src/net/ip_test.cpp
+++ b/src/net/ip_test.cpp
@@ -30,8 +30,6 @@
namespace tmwa
{
-#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
-
#define CB(X) (std::integral_constant<bool, (X)>::value)
TEST(ip4addr, cmp)
{
diff --git a/src/net/socket.cpp b/src/net/socket.cpp
index 548d3c6..a01cd81 100644
--- a/src/net/socket.cpp
+++ b/src/net/socket.cpp
@@ -55,11 +55,11 @@ const uint32_t RFIFO_SIZE = 65536;
static
const uint32_t WFIFO_SIZE = 65536;
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wold-style-cast"
+DIAG_PUSH();
+DIAG_I(old_style_cast);
static
std::array<std::unique_ptr<Session>, FD_SETSIZE> session;
-#pragma GCC diagnostic pop
+DIAG_POP();
Session::Session(SessionIO io, SessionParsers p)
: created()
@@ -269,14 +269,12 @@ Session *make_listen_port(uint16_t port, SessionParsers inferior)
fd.setsockopt(IPPROTO_TCP, TCP_NODELAY, &yes, sizeof yes);
server_address.sin_family = AF_INET;
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wold-style-cast"
-#if __GNUC__ > 4 || __GNUC_MINOR__ >= 8
-# pragma GCC diagnostic ignored "-Wuseless-cast"
-#endif
+ DIAG_PUSH();
+ DIAG_I(old_style_cast);
+ DIAG_I(useless_cast);
server_address.sin_addr.s_addr = htonl(INADDR_ANY);
server_address.sin_port = htons(port);
-#pragma GCC diagnostic pop
+ DIAG_POP();
if (fd.bind(reinterpret_cast<struct sockaddr *>(&server_address),
sizeof(server_address)) == -1)
@@ -330,13 +328,11 @@ Session *make_connection(IP4Address ip, uint16_t port, SessionParsers parsers)
server_address.sin_family = AF_INET;
server_address.sin_addr = in_addr(ip);
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wold-style-cast"
-#if __GNUC__ > 4 || __GNUC_MINOR__ >= 8
-# pragma GCC diagnostic ignored "-Wuseless-cast"
-#endif
+ DIAG_PUSH();
+ DIAG_I(old_style_cast);
+ DIAG_I(useless_cast);
server_address.sin_port = htons(port);
-#pragma GCC diagnostic pop
+ DIAG_POP();
fd.fcntl(F_SETFL, O_NONBLOCK);
diff --git a/src/range/slice_test.cpp b/src/range/slice_test.cpp
index f49b360..d31d973 100644
--- a/src/range/slice_test.cpp
+++ b/src/range/slice_test.cpp
@@ -25,8 +25,6 @@
namespace tmwa
{
-#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
-
TEST(slice, slice)
{
int init[] = {1, 2, 3, 4, 5};
diff --git a/src/sexpr/lexer_test.cpp b/src/sexpr/lexer_test.cpp
index 0fc3901..fdb47f2 100644
--- a/src/sexpr/lexer_test.cpp
+++ b/src/sexpr/lexer_test.cpp
@@ -29,8 +29,6 @@
namespace tmwa
{
-#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
-
static
io::FD string_pipe(ZString sz)
{
diff --git a/src/sexpr/parser_test.cpp b/src/sexpr/parser_test.cpp
index 5113c1a..846d425 100644
--- a/src/sexpr/parser_test.cpp
+++ b/src/sexpr/parser_test.cpp
@@ -25,8 +25,6 @@
namespace tmwa
{
-#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
-
static
io::FD string_pipe(ZString sz)
{
diff --git a/src/sexpr/variant_test.cpp b/src/sexpr/variant_test.cpp
index 1ecb82f..5a75780 100644
--- a/src/sexpr/variant_test.cpp
+++ b/src/sexpr/variant_test.cpp
@@ -27,8 +27,6 @@
namespace tmwa
{
-#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
-
struct Tracker
{
int id, moves, copies;
diff --git a/src/sexpr/void.hpp b/src/sexpr/void.hpp
index 4ef20cc..a17de9d 100644
--- a/src/sexpr/void.hpp
+++ b/src/sexpr/void.hpp
@@ -28,7 +28,7 @@ namespace sexpr
struct Void
{
template<class T>
- constexpr operator T() noexcept { return T(); }
+ constexpr operator T() const noexcept { return T(); }
template<class T>
void operator = (T&&) noexcept {}
template<class T>
diff --git a/src/strings/base_test.cpp b/src/strings/base_test.cpp
index 2083fdc..f9b9ca6 100644
--- a/src/strings/base_test.cpp
+++ b/src/strings/base_test.cpp
@@ -28,9 +28,6 @@
#include "../poison.hpp"
-#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
-
-
namespace tmwa
{
using namespace strings;
diff --git a/src/strings/strings2_test.cpp b/src/strings/strings2_test.cpp
index 872d201..18c7db4 100644
--- a/src/strings/strings2_test.cpp
+++ b/src/strings/strings2_test.cpp
@@ -26,8 +26,6 @@
namespace tmwa
{
-#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
-
TEST(StringTests, traits2)
{
ZString print_non = "\t\e"_s;
diff --git a/src/strings/strings_test.cpp b/src/strings/strings_test.cpp
index 8c3d80a..a95499d 100644
--- a/src/strings/strings_test.cpp
+++ b/src/strings/strings_test.cpp
@@ -28,8 +28,6 @@
namespace tmwa
{
-#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
-
template<typename T>
class StringTest : public ::testing::Test
{
diff --git a/src/warning_list.hpp b/src/warning_list.hpp
new file mode 100644
index 0000000..6b45375
--- /dev/null
+++ b/src/warning_list.hpp
@@ -0,0 +1,1256 @@
+#pragma once
+// warning_list.hpp - List of useful warnings.
+//
+// Copyright © 2013-2014 Ben Longbons <b.r.longbons@gmail.com>
+//
+// This file is part of The Mana World (Athena server)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+// just mention "fwd.hpp" to make formatter happy
+
+
+namespace tmwa
+{
+// Notes about reading this file:
+// * Currently only implemented for C++, but could work in C
+// * the HAS_DIAG_ is subject to an additional check for clang
+// * because token dispatching, it can't be #define HAS_XXX (GCC >= yyy)
+// * gcc 4.6 is required for function scope pragmas
+// * when upgrading compiler, diff 'gcc --help=warnings'
+// * clang-specific warning support is incomplete
+
+// List of warnings that require arguments,
+// and thus cannot reliably be activated:
+// gcc 4.6:
+// -Wlarger-than=<1024>
+// -Wnormalized=<id|nfc|nfd>
+// -Wsuggest-attribute=<noreturn,const,pure,format>
+// gcc 4.7:
+// -Wstack-usage=<8192>
+// ???:
+// -Wstrict-aliasing=<1>
+// -Wstrict-overflow=<1>
+
+#ifdef __GNUC__
+# ifdef __clang__
+# define GCC (0)
+# define CLANG (1) // clang's versions are vendor-specific - stupid apple
+# else
+# define GCC (__GNUC__ * 100 + __GNUC_MINOR__)
+# define CLANG (0)
+# endif
+#endif
+
+#if GCC >= 406 || CLANG
+# define PRAGMA(x) _Pragma(#x) static_assert(1, "I like my semicolons")
+#else
+# define PRAGMA(x) static_assert(1, "pragmas not available, can't do: " #x)
+#endif
+
+PRAGMA(GCC diagnostic warning "-Wall");
+PRAGMA(GCC diagnostic warning "-Wextra");
+PRAGMA(GCC diagnostic warning "-Wunused");
+PRAGMA(GCC diagnostic warning "-Wformat");
+
+#define DIAG_E(tag) DO_DIAG_IF(HAS_DIAG_##tag)(error, DIAG_##tag)
+#define DIAG_W(tag) DO_DIAG_IF(HAS_DIAG_##tag)(warning, DIAG_##tag)
+#define DIAG_I(tag) DO_DIAG_IF(HAS_DIAG_##tag)(ignored, DIAG_##tag)
+#define DIAG_X(tag) DO_DIAG_IF(HAS_DIAG_##tag)(ignored, DIAG_##tag)
+
+#define DO_DIAG_IF(c) JOIN_PLEASE(PRAGMA_IF_,c)
+#define JOIN_PLEASE(a, b) a##b
+#define PRAGMA_IF_0(lvl, str) static_assert(1, "warning " #str " not enabled for this compiler version, sorry")
+#if CLANG
+# define PRAGMA_IF_1(lvl, str) DO_DIAG_IF2(__has_warning(str))(lvl, str)
+# define DO_DIAG_IF2(s) JOIN_PLEASE(PRAGMA_IF2_, s)
+# define PRAGMA_IF2_0(lvl, str) static_assert(1, "warning " #str " not available in this compiler version, sorry")
+# define PRAGMA_IF2_1(lvl, str) PRAGMA(GCC diagnostic lvl str)
+#else
+# define PRAGMA_IF_1(lvl, str) PRAGMA(GCC diagnostic lvl str)
+#endif
+
+#define DIAG_PUSH() PRAGMA(GCC diagnostic push)
+#define DIAG_POP() PRAGMA(GCC diagnostic pop)
+
+
+/// Warn about things that will change when compiling
+/// with an ABI-compliant compiler
+// see note about -fabi-version=6 in the makefile
+#define DIAG_abi "-Wabi"
+#if 1
+# define HAS_DIAG_abi 1
+#else
+# define HAS_DIAG_abi 0
+#endif
+
+/// Warn if a subobject has an abi_tag attribute that
+/// the complete object type does not have
+#define DIAG_abi_tag "-Wabi-tag"
+#if GCC >= 408
+# define HAS_DIAG_abi_tag 1
+#else
+# define HAS_DIAG_abi_tag 0
+#endif
+
+/// Warn about suspicious uses of memory addresses
+#define DIAG_address "-Waddress"
+#if 1
+# define HAS_DIAG_address 1
+#else
+# define HAS_DIAG_address 0
+#endif
+
+/// Warn about returning structures, unions or arrays
+#define DIAG_aggregate_return "-Waggregate-return"
+#if 1
+# define HAS_DIAG_aggregate_return 1
+#else
+# define HAS_DIAG_aggregate_return 0
+#endif
+
+/// Warn if an array is accessed out of bounds
+#define DIAG_array_bounds "-Warray-bounds"
+#if 1
+# define HAS_DIAG_array_bounds 1
+#else
+# define HAS_DIAG_array_bounds 0
+#endif
+
+/// Warn about inappropriate attribute usage
+#define DIAG_attributes "-Wattributes"
+#if 1
+# define HAS_DIAG_attributes 1
+#else
+# define HAS_DIAG_attributes 0
+#endif
+
+/// Warn when a built-in preprocessor macro is
+// undefined or redefined
+#define DIAG_builtin_macro_redefined "-Wbuiltin-macro-redefined"
+#if 1
+# define HAS_DIAG_builtin_macro_redefined 1
+#else
+# define HAS_DIAG_builtin_macro_redefined 0
+#endif
+
+/// Warn about C++ constructs whose meaning differs
+/// between ISO C++ 1998 and ISO C++ 2011
+#if CLANG || GCC >= 407
+# define DIAG_cxx0x_compat "-Wc++11-compat"
+# define DIAG_cxx11_compat "-Wc++11-compat"
+#else
+# define DIAG_cxx0x_compat "-Wc++0x-compat"
+# define DIAG_cxx11_compat "-Wc++0x-compat"
+#endif
+#if 1
+# define HAS_DIAG_cxx0x_compat 1
+# define HAS_DIAG_cxx11_compat 1
+#else
+# define HAS_DIAG_cxx0x_compat 0
+# define HAS_DIAG_cxx11_compat 0
+#endif
+
+// I care about whether my code compiles with the standard as implemented
+// by certain compilers, not whether it matches with an *exact* standard.
+#define DIAG_cxx1y_extensions "-Wc++1y-extensions"
+#if CLANG
+# define HAS_DIAG_cxx1y_extensions 1
+#else
+# define HAS_DIAG_cxx1y_extensions 0
+#endif
+
+/// Warn about pointer casts which increase alignment
+#define DIAG_cast_align "-Wcast-align"
+#if 1
+# define HAS_DIAG_cast_align 1
+#else
+# define HAS_DIAG_cast_align 0
+#endif
+
+/// Warn about casts which discard qualifiers
+#define DIAG_cast_qual "-Wcast-qual"
+#if 1
+# define HAS_DIAG_cast_qual 1
+#else
+# define HAS_DIAG_cast_qual 0
+#endif
+
+/// Warn about subscripts whose type is "char"
+#define DIAG_char_subscripts "-Wchar-subscripts"
+#if 1
+# define HAS_DIAG_char_subscripts 1
+#else
+# define HAS_DIAG_char_subscripts 0
+#endif
+
+/// Warn about variables that might be changed by
+/// "longjmp" or "vfork"
+#define DIAG_clobbered "-Wclobbered"
+#if GCC
+# define HAS_DIAG_clobbered 1
+#else
+# define HAS_DIAG_clobbered 0
+#endif
+
+/// Warn about possibly nested block comments, and
+/// C++ comments spanning more than one physical line
+#define DIAG_comment "-Wcomment"
+#if 1
+# define HAS_DIAG_comment 1
+#else
+# define HAS_DIAG_comment 0
+#endif
+
+/// Warn for conditionally-supported constructs
+#define DIAG_conditionally_supported "-Wconditionally-supported"
+#if GCC >= 409
+# define HAS_DIAG_conditionally_supported 1
+#else
+# define HAS_DIAG_conditionally_supported 0
+#endif
+
+// A fixable difference between c++11 and c++14
+#define DIAG_constexpr_not_const "-Wconstexpr-not-const"
+#if CLANG
+# define HAS_DIAG_constexpr_not_const 1
+#else
+# define HAS_DIAG_constexpr_not_const 0
+#endif
+
+/// Warn for implicit type conversions that may
+/// change a value
+#define DIAG_conversion "-Wconversion"
+#if 1
+# define HAS_DIAG_conversion 1
+#else
+# define HAS_DIAG_conversion 0
+#endif
+
+/// Warn for converting NULL from/to a non-pointer
+/// type
+#define DIAG_conversion_null "-Wconversion-null"
+#if 1
+# define HAS_DIAG_conversion_null 1
+#else
+# define HAS_DIAG_conversion_null 0
+#endif
+
+/// Warn in case profiles in -fprofile-use do not
+/// match
+#define DIAG_coverage_mismatch "-Wcoverage-mismatch"
+#if GCC
+# define HAS_DIAG_coverage_mismatch 1
+#else
+# define HAS_DIAG_coverage_mismatch 0
+#endif
+
+///
+#define DIAG_covered_switch_default "-Wcovered-switch-default"
+#if CLANG
+# define HAS_DIAG_covered_switch_default 1
+#else
+# define HAS_DIAG_covered_switch_default 0
+#endif
+
+/// Warn when a #warning directive is encountered
+#define DIAG_cpp "-Wcpp"
+#if GCC
+# define HAS_DIAG_cpp 1
+#else
+# define HAS_DIAG_cpp 0
+#endif
+
+/// Warn when all constructors and destructors are
+/// private
+#define DIAG_ctor_dtor_privacy "-Wctor-dtor-privacy"
+#if 1
+# define HAS_DIAG_ctor_dtor_privacy 1
+#else
+# define HAS_DIAG_ctor_dtor_privacy 0
+#endif
+
+/// Warn about __TIME__, __DATE__ and __TIMESTAMP__
+/// usage
+#define DIAG_date_time "-Wdate-time"
+#if GCC >= 409
+# define HAS_DIAG_date_time 1
+#else
+# define HAS_DIAG_date_time 0
+#endif
+
+/// Warn when deleting a pointer to incomplete type
+#define DIAG_delete_incomplete "-Wdelete-incomplete"
+#if GCC >= 409
+# define HAS_DIAG_delete_incomplete 1
+#else
+# define HAS_DIAG_delete_incomplete 0
+#endif
+
+/// Warn about deleting polymorphic objects with non-
+/// virtual destructors
+#define DIAG_delete_non_virtual_dtor "-Wdelete-non-virtual-dtor"
+#if GCC >= 407
+# define HAS_DIAG_delete_non_virtual_dtor 1
+#else
+# define HAS_DIAG_delete_non_virtual_dtor 0
+#endif
+
+/// Warn if a deprecated compiler feature, class,
+/// method, or field is used
+#define DIAG_deprecated "-Wdeprecated"
+#if 1
+# define HAS_DIAG_deprecated 1
+#else
+# define HAS_DIAG_deprecated 0
+#endif
+
+/// Warn about uses of __attribute__((deprecated)")
+/// declarations
+#define DIAG_deprecated_declarations "-Wdeprecated-declarations"
+#if 1
+# define HAS_DIAG_deprecated_declarations 1
+#else
+# define HAS_DIAG_deprecated_declarations 0
+#endif
+
+/// Warn when an optimization pass is disabled
+#define DIAG_disabled_optimization "-Wdisabled-optimization"
+#if 1
+# define HAS_DIAG_disabled_optimization 1
+#else
+# define HAS_DIAG_disabled_optimization 0
+#endif
+
+/// Warn about compile-time integer division by zero
+#define DIAG_div_by_zero "-Wdiv-by-zero"
+#if 1
+# define HAS_DIAG_div_by_zero 1
+#else
+# define HAS_DIAG_div_by_zero 0
+#endif
+
+///
+#define DIAG_documentation "-Wdocumentation"
+#if CLANG
+# define HAS_DIAG_documentation 1
+#else
+# define HAS_DIAG_documentation 0
+#endif
+
+/// Warn about implicit conversions from "float" to
+/// "double"
+#define DIAG_double_promotion "-Wdouble-promotion"
+#if GCC
+# define HAS_DIAG_double_promotion 1
+#else
+# define HAS_DIAG_double_promotion 0
+#endif
+
+/// Warn about violations of Effective C++ style rules
+#define DIAG_effcxx "-Weffc++"
+#if 1
+# define HAS_DIAG_effcxx 1
+#else
+# define HAS_DIAG_effcxx 0
+#endif
+
+/// Warn about an empty body in an if or else
+/// statement
+#define DIAG_empty_body "-Wempty-body"
+#if 1
+# define HAS_DIAG_empty_body 1
+#else
+# define HAS_DIAG_empty_body 0
+#endif
+
+/// Warn about stray tokens after #elif and #endif
+#define DIAG_endif_labels "-Wendif-labels"
+#if 1
+# define HAS_DIAG_endif_labels 1
+#else
+# define HAS_DIAG_endif_labels 0
+#endif
+
+/// Warn about comparison of different enum types
+#define DIAG_enum_compare "-Wenum-compare"
+#if 1
+# define HAS_DIAG_enum_compare 1
+#else
+# define HAS_DIAG_enum_compare 0
+#endif
+
+///
+#define DIAG_extra_semi "-Wextra-semi"
+#if CLANG
+# define HAS_DIAG_extra_semi 1
+#else
+# define HAS_DIAG_extra_semi 0
+#endif
+
+/// Warn if testing floating point numbers for
+/// equality
+#define DIAG_float_equal "-Wfloat-equal"
+#if 1
+# define HAS_DIAG_float_equal 1
+#else
+# define HAS_DIAG_float_equal 0
+#endif
+
+/// Warn about printf/scanf/strftime/strfmon format
+/// string anomalies
+// see below
+#define DIAG_format "-Wformat"
+#if GCC
+# define HAS_DIAG_format 1
+#else
+# define HAS_DIAG_format 0
+#endif
+// but gcc 4.8 warns on %ms, since we enabled -Wpedantic.
+//WG48("-Wformat")
+
+/// Warn about format strings that contain NUL bytes
+#define DIAG_format_contains_nul "-Wformat-contains-nul"
+#if GCC
+# define HAS_DIAG_format_contains_nul 1
+#else
+# define HAS_DIAG_format_contains_nul 0
+#endif
+
+/// Warn if passing too many arguments to a function
+/// for its format string
+#define DIAG_format_extra_args "-Wformat-extra-args"
+#if 1
+# define HAS_DIAG_format_extra_args 1
+#else
+# define HAS_DIAG_format_extra_args 0
+#endif
+
+/// Warn about format strings that are not literals
+// Available in clang, but not smart enough to handle constexpr.
+#define DIAG_format_nonliteral "-Wformat-nonliteral"
+#if GCC || (CLANG && 1)
+# define HAS_DIAG_format_nonliteral 1
+#else
+# define HAS_DIAG_format_nonliteral 0
+#endif
+
+/// Warn about possible security problems with format
+/// functions
+// Same.
+#define DIAG_format_security "-Wformat-security"
+#if GCC || (CLANG && 1)
+# define HAS_DIAG_format_security 1
+#else
+# define HAS_DIAG_format_security 0
+#endif
+
+/// Warn about strftime formats yielding 2-digit years
+#define DIAG_format_y2k "-Wformat-y2k"
+#if 1
+# define HAS_DIAG_format_y2k 1
+#else
+# define HAS_DIAG_format_y2k 0
+#endif
+
+/// Warn about zero-length formats
+#define DIAG_format_zero_length "-Wformat-zero-length"
+#if 1
+# define HAS_DIAG_format_zero_length 1
+#else
+# define HAS_DIAG_format_zero_length 0
+#endif
+
+/// Warn when attempting to free a non-heap object
+#define DIAG_free_nonheap_object "-Wfree-nonheap-object"
+#if GCC >= 407
+# define HAS_DIAG_free_nonheap_object 1
+#else
+# define HAS_DIAG_free_nonheap_object 0
+#endif
+
+// -Wgnu is a clang alias for -Wpedantic
+
+// Foo{x: y}
+#define DIAG_gnu_designator "-Wgnu-designator"
+#if CLANG
+# define HAS_DIAG_gnu_designator 1
+#else
+# define HAS_DIAG_gnu_designator 0
+#endif
+
+
+/// Warn whenever type qualifiers are ignored.
+#define DIAG_ignored_qualifiers "-Wignored-qualifiers"
+#if 1
+# define HAS_DIAG_ignored_qualifiers 1
+#else
+# define HAS_DIAG_ignored_qualifiers 0
+#endif
+
+///
+#define DIAG_implicit_fallthrough "-Wimplicit-fallthrough"
+#if CLANG
+# define HAS_DIAG_implicit_fallthrough 1
+#else
+# define HAS_DIAG_implicit_fallthrough 0
+#endif
+
+/// Warn about C++11 inheriting constructors when the
+/// base has a variadic constructor
+#define DIAG_inherited_variadic_ctor "-Winherited-variadic-ctor"
+#if GCC >= 408
+# define HAS_DIAG_inherited_variadic_ctor 1
+#else
+# define HAS_DIAG_inherited_variadic_ctor 0
+#endif
+
+/// Warn about variables which are initialized to
+/// themselves
+#define DIAG_init_self "-Winit-self"
+#if 1
+# define HAS_DIAG_init_self 1
+#else
+# define HAS_DIAG_init_self 0
+#endif
+
+/// Warn when an inlined function cannot be inlined
+#define DIAG_inline "-Winline"
+#if 1
+# define HAS_DIAG_inline 1
+#else
+# define HAS_DIAG_inline 0
+#endif
+
+/// Warn when there is a cast to a pointer from an
+/// integer of a different size
+#define DIAG_int_to_pointer_cast "-Wint-to-pointer-cast"
+#if 1
+# define HAS_DIAG_int_to_pointer_cast 1
+#else
+# define HAS_DIAG_int_to_pointer_cast 0
+#endif
+
+/// Warn when an atomic memory model parameter is
+/// known to be outside the valid range.
+#define DIAG_invalid_memory_model "-Winvalid-memory-model"
+#if GCC >= 407
+# define HAS_DIAG_invalid_memory_model 1
+#else
+# define HAS_DIAG_invalid_memory_model 0
+#endif
+
+/// Warn about invalid uses of the "offsetof" macro
+#define DIAG_invalid_offsetof "-Winvalid-offsetof"
+#if 1
+# define HAS_DIAG_invalid_offsetof 1
+#else
+# define HAS_DIAG_invalid_offsetof 0
+#endif
+
+/// Warn about PCH files that are found but not used
+#define DIAG_invalid_pch "-Winvalid-pch"
+#if 1
+# define HAS_DIAG_invalid_pch 1
+#else
+# define HAS_DIAG_invalid_pch 0
+#endif
+
+/// Warn when a string or character literal is
+/// followed by a ud-suffix which does not begin with
+/// an underscore.
+#define DIAG_literal_suffix "-Wliteral-suffix"
+#if GCC >= 408
+# define HAS_DIAG_literal_suffix 1
+#else
+# define HAS_DIAG_literal_suffix 0
+#endif
+
+/// Warn when a logical operator is suspiciously
+/// always evaluating to true or false
+#define DIAG_logical_op "-Wlogical-op"
+#if GCC
+# define HAS_DIAG_logical_op 1
+#else
+# define HAS_DIAG_logical_op 0
+#endif
+
+/// Do not warn about using "long long" when -pedantic
+#define DIAG_long_long "-Wlong-long"
+#if 1
+# define HAS_DIAG_long_long 1
+#else
+# define HAS_DIAG_long_long 0
+#endif
+
+/// Warn about suspicious declarations of "main"
+#define DIAG_main "-Wmain"
+#if 1
+# define HAS_DIAG_main 1
+#else
+# define HAS_DIAG_main 0
+#endif
+
+/// Warn about maybe uninitialized automatic variables
+#define DIAG_maybe_uninitialized "-Wmaybe-uninitialized"
+#if GCC >= 407
+# define HAS_DIAG_maybe_uninitialized 1
+#else
+# define HAS_DIAG_maybe_uninitialized 0
+#endif
+
+// bitch about 'struct Foo' vs 'class Foo'
+#define DIAG_mismatched_tags "-Wmismatched-tags"
+#if CLANG
+# define HAS_DIAG_mismatched_tags 1
+#else
+# define HAS_DIAG_mismatched_tags 0
+#endif
+
+/// Warn about possibly missing braces around
+/// initializers
+// beware of things like std::array!
+#define DIAG_missing_braces "-Wmissing-braces"
+#if 1
+# define HAS_DIAG_missing_braces 1
+#else
+# define HAS_DIAG_missing_braces 0
+#endif
+
+/// Warn about global functions without previous
+/// declarations
+// This doesn't work for clang, it wants -Wmissing-prototypes instead.
+#define DIAG_missing_declarations "-Wmissing-declarations"
+#if 1
+# define HAS_DIAG_missing_declarations 1
+#else
+# define HAS_DIAG_missing_declarations 0
+#endif
+
+/// Warn about missing fields in struct initializers
+// Actually supported by GCC, but gives warnings when I don't want, e.g.:
+// Foo foo = {};
+#define DIAG_missing_field_initializers "-Wmissing-field-initializers"
+#if CLANG || (GCC && 1)
+# define HAS_DIAG_missing_field_initializers 1
+#else
+# define HAS_DIAG_missing_field_initializers 0
+#endif
+
+/// Warn about functions which might be candidates
+/// for format attributes
+#define DIAG_missing_format_attribute "-Wmissing-format-attribute"
+#if 1
+# define HAS_DIAG_missing_format_attribute 1
+#else
+# define HAS_DIAG_missing_format_attribute 0
+#endif
+
+/// Warn about user-specified include directories
+/// that do not exist
+#define DIAG_missing_include_dirs "-Wmissing-include-dirs"
+#if 1
+# define HAS_DIAG_missing_include_dirs 1
+#else
+# define HAS_DIAG_missing_include_dirs 0
+#endif
+
+/// Warn about functions which might be candidates
+/// for __attribute__((noreturn)")
+#define DIAG_missing_noreturn "-Wmissing-noreturn"
+#if 1
+# define HAS_DIAG_missing_noreturn 1
+#else
+# define HAS_DIAG_missing_noreturn 0
+#endif
+
+// clang uses this instead of -Wmissing-declarations
+#define DIAG_missing_prototypes "-Wmissing-prototypes"
+#if CLANG
+# define HAS_DIAG_missing_prototypes 1
+#else
+# define HAS_DIAG_missing_prototypes 0
+#endif
+
+///
+// like -Wmissing-declarations but for variables instead of functions
+#define DIAG_missing_variable_declarations "-Wmissing-variable-declarations"
+#if CLANG
+# define HAS_DIAG_missing_variable_declarations 1
+#else
+# define HAS_DIAG_missing_variable_declarations 0
+#endif
+
+/// Warn about constructs not instrumented by
+/// -fmudflap
+#define DIAG_mudflap "-Wmudflap"
+#if GCC
+# define HAS_DIAG_mudflap 1
+#else
+# define HAS_DIAG_mudflap 0
+#endif
+
+/// Warn about use of multi-character character
+/// constants
+#define DIAG_multichar "-Wmultichar"
+#if 1
+# define HAS_DIAG_multichar 1
+#else
+# define HAS_DIAG_multichar 0
+#endif
+
+/// Warn about narrowing conversions within { } that
+/// are ill-formed in C++11
+#define DIAG_narrowing "-Wnarrowing"
+#if GCC >= 407
+# define HAS_DIAG_narrowing 1
+#else
+# define HAS_DIAG_narrowing 0
+#endif
+
+/// Warn when a noexcept expression evaluates to
+/// false even though the expression can't actually
+/// throw
+#define DIAG_noexcept "-Wnoexcept"
+#if GCC
+# define HAS_DIAG_noexcept 1
+#else
+# define HAS_DIAG_noexcept 0
+#endif
+
+/// Warn when non-templatized friend functions are
+/// declared within a template
+#define DIAG_non_template_friend "-Wnon-template-friend"
+#if GCC
+# define HAS_DIAG_non_template_friend 1
+#else
+# define HAS_DIAG_non_template_friend 0
+#endif
+
+/// Warn about non-virtual destructors
+#define DIAG_non_virtual_dtor "-Wnon-virtual-dtor"
+#if 1
+# define HAS_DIAG_non_virtual_dtor 1
+#else
+# define HAS_DIAG_non_virtual_dtor 0
+#endif
+
+/// Warn about NULL being passed to argument slots
+/// marked as requiring non-NULL
+#define DIAG_nonnull "-Wnonnull"
+#if 1
+# define HAS_DIAG_nonnull 1
+#else
+# define HAS_DIAG_nonnull 0
+#endif
+
+///
+#define DIAG_null_conversion "-Wnull-conversion"
+#if CLANG
+# define HAS_DIAG_null_conversion 1
+#else
+# define HAS_DIAG_null_conversion 0
+#endif
+
+/// Warn if a C-style cast is used in a program
+#define DIAG_old_style_cast "-Wold-style-cast"
+#if 1
+# define HAS_DIAG_old_style_cast 1
+#else
+# define HAS_DIAG_old_style_cast 0
+#endif
+
+/// Warn about overflow in arithmetic expressions
+#define DIAG_overflow "-Woverflow"
+#if 1
+# define HAS_DIAG_overflow 1
+#else
+# define HAS_DIAG_overflow 0
+#endif
+
+/// Warn if a simd directive is overridden by the
+/// vectorizer cost model
+#define DIAG_openmp_simd "-Wopenmp-simd"
+#if GCC >= 409
+# define HAS_DIAG_openmp_simd 1
+#else
+# define HAS_DIAG_openmp_simd 0
+#endif
+
+/// Warn if a string is longer than the maximum
+/// portable length specified by the standard
+//X("-Woverlength-strings")
+
+/// Warn about overloaded virtual function names
+#define DIAG_overloaded_virtual "-Woverloaded-virtual"
+#if 1
+# define HAS_DIAG_overloaded_virtual 1
+#else
+# define HAS_DIAG_overloaded_virtual 0
+#endif
+
+/// Warn when the packed attribute has no effect on
+/// struct layout
+#define DIAG_packed "-Wpacked"
+#if 1
+# define HAS_DIAG_packed 1
+#else
+# define HAS_DIAG_packed 0
+#endif
+
+/// Warn about packed bit-fields whose offset changed
+/// in GCC 4.4
+#define DIAG_packed_bitfield_compat "-Wpacked-bitfield-compat"
+#if GCC
+# define HAS_DIAG_packed_bitfield_compat 1
+#else
+# define HAS_DIAG_packed_bitfield_compat 0
+#endif
+
+/// Warn when padding is required to align structure
+/// members
+#define DIAG_padded "-Wpadded"
+#if 1
+# define HAS_DIAG_padded 1
+#else
+# define HAS_DIAG_padded 0
+#endif
+
+/// Warn about possibly missing parentheses
+#define DIAG_parentheses "-Wparentheses"
+#if 1
+# define HAS_DIAG_parentheses 1
+#else
+# define HAS_DIAG_parentheses 0
+#endif
+
+/// Issue warnings needed for strict compliance to
+/// the standard
+// a bit too noisy
+//EG48("-Wpedantic")
+// lots of minor extensions are used
+#define DIAG_pedantic "-Wpedantic"
+#if GCC >= 408 || CLANG
+# define HAS_DIAG_pedantic 1
+#else
+# define HAS_DIAG_pedantic 0
+#endif
+
+/// Warn when converting the type of pointers to
+/// member functions
+#define DIAG_pmf_conversions "-Wpmf-conversions"
+#if GCC
+# define HAS_DIAG_pmf_conversions 1
+#else
+# define HAS_DIAG_pmf_conversions 0
+#endif
+
+/// Warn about function pointer arithmetic
+#define DIAG_pointer_arith "-Wpointer-arith"
+#if 1
+# define HAS_DIAG_pointer_arith 1
+#else
+# define HAS_DIAG_pointer_arith 0
+#endif
+
+/// Warn about misuses of pragmas
+#define DIAG_pragmas "-Wpragmas"
+#if GCC
+# define HAS_DIAG_pragmas 1
+#else
+# define HAS_DIAG_pragmas 0
+#endif
+
+/// Warn about multiple declarations of the same
+/// object
+#define DIAG_redundant_decls "-Wredundant-decls"
+#if 1
+# define HAS_DIAG_redundant_decls 1
+#else
+# define HAS_DIAG_redundant_decls 0
+#endif
+
+/// Warn when the compiler reorders code
+#define DIAG_reorder "-Wreorder"
+#if 1
+# define HAS_DIAG_reorder 1
+#else
+# define HAS_DIAG_reorder 0
+#endif
+
+/// Warn about returning a pointer/reference to a
+/// local or temporary variable.
+#define DIAG_return_local_addr "-Wreturn-local-addr"
+#if GCC >= 408
+# define HAS_DIAG_return_local_addr 1
+#else
+# define HAS_DIAG_return_local_addr 0
+#endif
+
+/// Warn whenever a function's return type defaults
+/// to "int" (C), or about inconsistent return types
+/// (C++")
+#define DIAG_return_type "-Wreturn-type"
+#if 1
+# define HAS_DIAG_return_type 1
+#else
+# define HAS_DIAG_return_type 0
+#endif
+
+/// Warn about possible violations of sequence point
+/// rules
+#define DIAG_sequence_point "-Wsequence-point"
+#if 1
+# define HAS_DIAG_sequence_point 1
+#else
+# define HAS_DIAG_sequence_point 0
+#endif
+
+/// Warn when one local variable shadows another
+#define DIAG_shadow "-Wshadow"
+#if 1
+# define HAS_DIAG_shadow 1
+#else
+# define HAS_DIAG_shadow 0
+#endif
+
+/// Warn about signed-unsigned comparisons
+#define DIAG_sign_compare "-Wsign-compare"
+#if 1
+# define HAS_DIAG_sign_compare 1
+#else
+# define HAS_DIAG_sign_compare 0
+#endif
+
+/// Warn when overload promotes from unsigned to
+/// signed
+#define DIAG_sign_promo "-Wsign-promo"
+#if 1
+# define HAS_DIAG_sign_promo 1
+#else
+# define HAS_DIAG_sign_promo 0
+#endif
+
+/// This switch lacks documentation
+#define DIAG_sizeof_pointer_memaccess "-Wsizeof-pointer-memaccess"
+#if GCC >= 408
+# define HAS_DIAG_sizeof_pointer_memaccess 1
+#else
+# define HAS_DIAG_sizeof_pointer_memaccess 0
+#endif
+
+/// Warn when not issuing stack smashing protection
+/// for some reason
+#define DIAG_stack_protector "-Wstack-protector"
+#if 1
+# define HAS_DIAG_stack_protector 1
+#else
+# define HAS_DIAG_stack_protector 0
+#endif
+
+/// Warn about code which might break strict aliasing
+/// rules
+#define DIAG_strict_aliasing "-Wstrict-aliasing"
+#if 1
+# define HAS_DIAG_strict_aliasing 1
+#else
+# define HAS_DIAG_strict_aliasing 0
+#endif
+
+/// Warn about uncasted NULL used as sentinel
+#define DIAG_strict_null_sentinel "-Wstrict-null-sentinel"
+#if GCC
+# define HAS_DIAG_strict_null_sentinel 1
+#else
+# define HAS_DIAG_strict_null_sentinel 0
+#endif
+
+/// Warn about optimizations that assume that signed
+/// overflow is undefined
+#define DIAG_strict_overflow "-Wstrict-overflow"
+#if 1
+# define HAS_DIAG_strict_overflow 1
+#else
+# define HAS_DIAG_strict_overflow 0
+#endif
+
+/// Warn about enumerated switches, with no default,
+/// missing a case
+#define DIAG_switch "-Wswitch"
+#if 1
+# define HAS_DIAG_switch 1
+#else
+# define HAS_DIAG_switch 0
+#endif
+
+/// Warn about enumerated switches missing a
+/// "default:" statement
+#define DIAG_switch_default "-Wswitch-default"
+#if 1
+# define HAS_DIAG_switch_default 1
+#else
+# define HAS_DIAG_switch_default 0
+#endif
+
+/// Warn about all enumerated switches missing a
+/// specific case
+#define DIAG_switch_enum "-Wswitch-enum"
+#if 1
+# define HAS_DIAG_switch_enum 1
+#else
+# define HAS_DIAG_switch_enum 0
+#endif
+
+/// Warn when __sync_fetch_and_nand and
+/// __sync_nand_and_fetch built-in functions are used
+#define DIAG_sync_nand "-Wsync-nand"
+#if GCC
+# define HAS_DIAG_sync_nand 1
+#else
+# define HAS_DIAG_sync_nand 0
+#endif
+
+/// Warn whenever a trampoline is generated
+#define DIAG_trampolines "-Wtrampolines"
+#if GCC
+# define HAS_DIAG_trampolines 1
+#else
+# define HAS_DIAG_trampolines 0
+#endif
+
+/// Warn if trigraphs are encountered that might
+/// affect the meaning of the program
+#define DIAG_trigraphs "-Wtrigraphs"
+#if 1
+# define HAS_DIAG_trigraphs 1
+#else
+# define HAS_DIAG_trigraphs 0
+#endif
+
+/// Warn if a comparison is always true or always
+/// false due to the limited range of the data type
+#define DIAG_type_limits "-Wtype-limits"
+#if 1
+# define HAS_DIAG_type_limits 1
+#else
+# define HAS_DIAG_type_limits 0
+#endif
+
+/// Warn if an undefined macro is used in an #if
+/// directive
+#define DIAG_undef "-Wundef"
+#if 1
+# define HAS_DIAG_undef 1
+#else
+# define HAS_DIAG_undef 0
+#endif
+
+/// Warn about uninitialized automatic variables
+#define DIAG_uninitialized "-Wuninitialized"
+#if 1
+# define HAS_DIAG_uninitialized 1
+#else
+# define HAS_DIAG_uninitialized 0
+#endif
+
+/// Warn about unrecognized pragmas
+#define DIAG_unknown_pragmas "-Wunknown-pragmas"
+#if 1
+# define HAS_DIAG_unknown_pragmas 1
+#else
+# define HAS_DIAG_unknown_pragmas 0
+#endif
+
+///
+// Not an error because of some remaining enum+default
+#define DIAG_unreachable_code "-Wunreachable-code"
+#if CLANG
+# define HAS_DIAG_unreachable_code 1
+#else
+# define HAS_DIAG_unreachable_code 0
+#endif
+
+/// Warn if the loop cannot be optimized due to
+/// nontrivial assumptions.
+#define DIAG_unsafe_loop_optimizations "-Wunsafe-loop-optimizations"
+#if GCC
+# define HAS_DIAG_unsafe_loop_optimizations 1
+#else
+# define HAS_DIAG_unsafe_loop_optimizations 0
+#endif
+
+/// Warn when a function parameter is only set,
+/// otherwise unused
+#define DIAG_unused_but_set_parameter "-Wunused-but-set-parameter"
+#if GCC
+# define HAS_DIAG_unused_but_set_parameter 1
+#else
+# define HAS_DIAG_unused_but_set_parameter 0
+#endif
+
+/// Warn when a variable is only set, otherwise unused
+#define DIAG_unused_but_set_variable "-Wunused-but-set-variable"
+#if GCC
+# define HAS_DIAG_unused_but_set_variable 1
+#else
+# define HAS_DIAG_unused_but_set_variable 0
+#endif
+
+/// Warn when a function is unused
+#define DIAG_unused_function "-Wunused-function"
+#if 1
+# define HAS_DIAG_unused_function 1
+#else
+# define HAS_DIAG_unused_function 0
+#endif
+
+/// Warn when a label is unused
+#define DIAG_unused_label "-Wunused-label"
+#if 1
+# define HAS_DIAG_unused_label 1
+#else
+# define HAS_DIAG_unused_label 0
+#endif
+
+/// Warn when typedefs locally defined in a function
+/// are not used
+#define DIAG_unused_local_typedefs "-Wunused-local-typedefs"
+#if GCC >= 407
+# define HAS_DIAG_unused_local_typedefs 1
+#else
+# define HAS_DIAG_unused_local_typedefs 0
+#endif
+
+/// Warn about macros defined in the main file that
+/// are not used
+#define DIAG_unused_macros "-Wunused-macros"
+#if 1
+# define HAS_DIAG_unused_macros 1
+#else
+# define HAS_DIAG_unused_macros 0
+#endif
+
+/// Warn when a function parameter is unused
+#define DIAG_unused_parameter "-Wunused-parameter"
+#if 1
+# define HAS_DIAG_unused_parameter 1
+#else
+# define HAS_DIAG_unused_parameter 0
+#endif
+
+/// Warn if a caller of a function, marked with
+/// attribute warn_unused_result, does not use its
+/// return value
+#define DIAG_unused_result "-Wunused-result"
+#if 1
+# define HAS_DIAG_unused_result 1
+#else
+# define HAS_DIAG_unused_result 0
+#endif
+
+/// Warn when an expression value is unused
+#define DIAG_unused_value "-Wunused-value"
+#if 1
+# define HAS_DIAG_unused_value 1
+#else
+# define HAS_DIAG_unused_value 0
+#endif
+
+/// Warn when a variable is unused
+#define DIAG_unused_variable "-Wunused-variable"
+#if 1
+# define HAS_DIAG_unused_variable 1
+#else
+# define HAS_DIAG_unused_variable 0
+#endif
+
+/// Warn about useless casts
+#define DIAG_useless_cast "-Wuseless-cast"
+#if GCC >= 408
+# define HAS_DIAG_useless_cast 1
+#else
+# define HAS_DIAG_useless_cast 0
+#endif
+
+/// Warn about questionable usage of the macros used
+/// to retrieve variable arguments
+#define DIAG_varargs "-Wvarargs"
+#if GCC >= 408
+# define HAS_DIAG_varargs 1
+#else
+# define HAS_DIAG_varargs 0
+#endif
+
+/// Warn about using variadic macros
+#define DIAG_variadic_macros "-Wvariadic-macros"
+#if 1
+# define HAS_DIAG_variadic_macros 1
+#else
+# define HAS_DIAG_variadic_macros 0
+#endif
+
+/// Warn when a vector operation is compiled
+/// outside the SIMD
+#define DIAG_vector_operation_performance "-Wvector-operation-performance"
+#if GCC >= 407
+# define HAS_DIAG_vector_operation_performance 1
+#else
+# define HAS_DIAG_vector_operation_performance 0
+#endif
+
+/// Warn if a virtual base has a non-trivial move
+/// assignment operator
+#define DIAG_virtual_move_assign "-Wvirtual-move-assign"
+#if GCC >= 408
+# define HAS_DIAG_virtual_move_assign 1
+#else
+# define HAS_DIAG_virtual_move_assign 0
+#endif
+
+/// Warn if a variable length array is used
+#define DIAG_vla "-Wvla"
+#if 1
+# define HAS_DIAG_vla 1
+#else
+# define HAS_DIAG_vla 0
+#endif
+
+/// Warn when a register variable is declared volatile
+#define DIAG_volatile_register_var "-Wvolatile-register-var"
+#if 1
+# define HAS_DIAG_volatile_register_var 1
+#else
+# define HAS_DIAG_volatile_register_var 0
+#endif
+
+/// In C++, nonzero means warn about deprecated
+/// conversion from string literals to 'char *'. In
+/// C, similar warning, except that the conversion is
+/// of course not deprecated by the ISO C standard.
+#define DIAG_write_strings "-Wwrite-strings"
+#if 1
+# define HAS_DIAG_write_strings 1
+#else
+# define HAS_DIAG_write_strings 0
+#endif
+
+/// Warn when a literal '0' is used as null
+/// pointer
+#define DIAG_zero_as_null_pointer_constant "-Wzero-as-null-pointer-constant"
+#if GCC >= 407
+# define HAS_DIAG_zero_as_null_pointer_constant 1
+#else
+# define HAS_DIAG_zero_as_null_pointer_constant 0
+#endif
+} // namespace tmwa
diff --git a/src/warnings.hpp b/src/warnings.hpp
index 97d85e3..e5fcf2d 100644
--- a/src/warnings.hpp
+++ b/src/warnings.hpp
@@ -1,7 +1,7 @@
#pragma once
// This is the first file in every compilation, passed by the makefile.
// This file contains only preprocessor directions.
-
+// The preceding sentence is a lie.
// warnings.hpp - Make the compiler do the hard work.
//
// Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com>
@@ -23,766 +23,163 @@
// just mention "fwd.hpp" to make formatter happy
+#include "warning_list.hpp"
+
namespace tmwa
{
-
-// This file is currently targeted at:
-// GCC 4.6 (incomplete due to bugs)
-// GCC 4.7 (for few minor workarounds)
-// GCC 4.8 (zarro boogs found)
-// GCC 4.9 (zarro boogs found)
-// clang 3.1 (may ICE later)
-// clang 3.2 (with a few major workarounds)
-
-// List of warnings that require arguments,
-// and thus cannot reliably be activated:
-// gcc 4.6:
-// -Wlarger-than=<1024>
-// -Wnormalized=<id|nfc|nfd>
-// -Wsuggest-attribute=<noreturn,const,pure,format>
-// gcc 4.7:
-// -Wstack-usage=<8192>
-// ???
-// -Wstrict-aliasing=<1>
-// -Wstrict-overflow=<1>
-
-// options that enable other options
-// only warnings so I can catch the errors
-#pragma GCC diagnostic warning "-Wall"
-#pragma GCC diagnostic warning "-Wextra"
-#pragma GCC diagnostic warning "-Wunused"
-#pragma GCC diagnostic warning "-Wformat"
-
-#ifdef __clang__
-# if __clang_major__ < 3
-# error "your clang is way too old"
-# elif __clang_major__ == 3
-# if __clang_minor__ < 1
-# error "your clang is too old"
-# endif // __clang_minor__
-# endif // __clang_major__
-#else // __clang__
-# if __GNUC__ < 4
-# error "your gcc is way too old"
-# if __GNUC_MINOR__ < 6
-# error "your gcc is too old"
-# elif __GNUC_MINOR__ == 6
-# if __GNUC_PATCHLEVEL__ < 3
-# error "TODO: test this patchlevel"
-# endif // __GNUC_PATCHLEVEL__
-# elif __GNUC_MINOR__ == 7
-# if __GNUC_PATCHLEVEL__ < 2
-# error "your gcc has a known bad patchlevel"
-# endif // __GNUC_PATCHLEVEL__
-# endif // __GNUC_MINOR__
-# endif // __GNUC__
-#endif // __clang__
-
-// BEGIN Macros to make my life easier
-
-// stringification requirement - #sw within #ar
-// this is a lie ^
-#define P(ar) _Pragma(#ar)
-
-// Use "GCC diagnostic" for warnings applicable to all versions.
-#define I(sw) P(GCC diagnostic ignored sw)
-#define W(sw) P(GCC diagnostic warning sw)
-#define E(sw) P(GCC diagnostic error sw)
-// configurable thing (also change in clang below!)
-#define X(sw) I(sw)
-
-
-#ifdef __clang__
-
-// Use "clang diagnostic" for warnings specific to clang
-# define IC(sw) P(clang diagnostic ignored sw)
-# define WC(sw) P(clang diagnostic warning sw)
-# define EC(sw) P(clang diagnostic error sw)
-# define XC(sw) IC(sw) // this is below
-
-// warning specific to gcc
-# define IG(sw) static_assert('I', sw "skipped for clang");
-# define WG(sw) static_assert('W', sw "skipped for clang");
-# define EG(sw) static_assert('E', sw "skipped for clang");
-# define XG(sw) static_assert('X', sw "skipped for clang");
-
-# define IG47(sw) static_assert('I', sw "only for gcc 4.7+");
-# define WG47(sw) static_assert('W', sw "only for gcc 4.7+");
-# define EG47(sw) static_assert('E', sw "only for gcc 4.7+");
-# define XG47(sw) static_assert('X', sw "only for gcc 4.7+");
-
-# define IG48(sw) static_assert('I', sw "only for gcc 4.8+");
-# define WG48(sw) static_assert('W', sw "only for gcc 4.8+");
-# define EG48(sw) static_assert('E', sw "only for gcc 4.8+");
-# define XG48(sw) static_assert('X', sw "only for gcc 4.8+");
-
-# define IG49(sw) static_assert('I', sw "only for gcc 4.9+");
-# define WG49(sw) static_assert('W', sw "only for gcc 4.9+");
-# define EG49(sw) static_assert('E', sw "only for gcc 4.9+");
-# define XG49(sw) static_assert('X', sw "only for gcc 4.9+");
-
-# define I47(sw) I(sw)
-# define W47(sw) W(sw)
-# define E47(sw) E(sw)
-# define X47(sw) X(sw)
-
-# define I48(sw) I(sw)
-# define W48(sw) W(sw)
-# define E48(sw) E(sw)
-# define X48(sw) X(sw)
-
-# define I49(sw) I(sw)
-# define W49(sw) W(sw)
-# define E49(sw) E(sw)
-# define X49(sw) X(sw)
-
+DIAG_E(abi);
+DIAG_W(abi_tag);
+DIAG_E(address);
+DIAG_I(aggregate_return);
+DIAG_E(array_bounds);
+DIAG_E(attributes);
+DIAG_E(builtin_macro_redefined);
+DIAG_I(cxx0x_compat);
+DIAG_I(cxx1y_extensions);
+DIAG_E(cast_align);
+DIAG_E(cast_qual);
+DIAG_E(char_subscripts);
+DIAG_E(clobbered);
+DIAG_E(comment);
+DIAG_E(conditionally_supported);
+DIAG_E(constexpr_not_const);
+DIAG_X(conversion);
+DIAG_E(conversion_null);
+DIAG_W(coverage_mismatch);
+DIAG_X(covered_switch_default);
+DIAG_W(cpp);
+DIAG_E(ctor_dtor_privacy);
+DIAG_E(date_time);
+DIAG_E(delete_incomplete);
+DIAG_E(delete_non_virtual_dtor);
+DIAG_W(deprecated);
+#ifdef QUIET
+DIAG_I(deprecated_declarations);
#else
-
-// warnings specific to clang
-# define IC(sw) static_assert('I', sw "skipped for gcc");
-# define WC(sw) static_assert('W', sw "skipped for gcc");
-# define EC(sw) static_assert('E', sw "skipped for gcc");
-# define XC(sw) static_assert('X', sw "skipped for gcc");
-
-// warnings specific to gcc
-# define IG(sw) I(sw)
-# define WG(sw) W(sw)
-# define EG(sw) E(sw)
-# define XG(sw) X(sw)
-
-// used both for warnings not implemented in a version
-// and for warnings that falsely trigger
-# if __GNUC__ == 4
-# if __GNUC_MINOR__ >= 7
-# define IG47(sw) IG(sw)
-# define WG47(sw) WG(sw)
-# define EG47(sw) EG(sw)
-# define XG47(sw) XG(sw)
-
-# define I47(sw) I(sw)
-# define W47(sw) W(sw)
-# define E47(sw) E(sw)
-# define X47(sw) X(sw)
-# else
-# define IG47(sw) static_assert('I', sw "only for gcc 4.7+");
-# define WG47(sw) static_assert('W', sw "only for gcc 4.7+");
-# define EG47(sw) static_assert('E', sw "only for gcc 4.7+");
-# define XG47(sw) static_assert('X', sw "only for gcc 4.7+");
-
-# define I47(sw) static_assert('I', sw "only for gcc 4.7+ or clang");
-# define W47(sw) static_assert('W', sw "only for gcc 4.7+ or clang");
-# define E47(sw) static_assert('E', sw "only for gcc 4.7+ or clang");
-# define X47(sw) static_assert('X', sw "only for gcc 4.7+ or clang");
-# endif // __GNUC_MINOR__
-# if __GNUC_MINOR__ >= 8
-# define IG48(sw) IG(sw)
-# define WG48(sw) WG(sw)
-# define EG48(sw) EG(sw)
-# define XG48(sw) XG(sw)
-
-# define I48(sw) IG(sw)
-# define W48(sw) WG(sw)
-# define E48(sw) EG(sw)
-# define X48(sw) XG(sw)
-# else
-# define IG48(sw) static_assert('I', sw "only for gcc 4.8+");
-# define WG48(sw) static_assert('W', sw "only for gcc 4.8+");
-# define EG48(sw) static_assert('E', sw "only for gcc 4.8+");
-# define XG48(sw) static_assert('X', sw "only for gcc 4.8+");
-
-# define I48(sw) static_assert('I', sw "only for gcc 4.8+ or clang");
-# define W48(sw) static_assert('W', sw "only for gcc 4.8+ or clang");
-# define E48(sw) static_assert('E', sw "only for gcc 4.8+ or clang");
-# define X48(sw) static_assert('X', sw "only for gcc 4.8+ or clang");
-# endif // __GNUC_MINOR__
-# if __GNUC_MINOR__ >= 9
-# define IG49(sw) IG(sw)
-# define WG49(sw) WG(sw)
-# define EG49(sw) EG(sw)
-# define XG49(sw) XG(sw)
-
-# define I49(sw) IG(sw)
-# define W49(sw) WG(sw)
-# define E49(sw) EG(sw)
-# define X49(sw) XG(sw)
-# else
-# define IG49(sw) static_assert('I', sw "only for gcc 4.9+");
-# define WG49(sw) static_assert('W', sw "only for gcc 4.9+");
-# define EG49(sw) static_assert('E', sw "only for gcc 4.9+");
-# define XG49(sw) static_assert('X', sw "only for gcc 4.9+");
-
-# define I49(sw) static_assert('I', sw "only for gcc 4.9+ or clang");
-# define W49(sw) static_assert('W', sw "only for gcc 4.9+ or clang");
-# define E49(sw) static_assert('E', sw "only for gcc 4.9+ or clang");
-# define X49(sw) static_assert('X', sw "only for gcc 4.9+ or clang");
-# endif // __GNUC_MINOR__
-# endif // __GNUC__
-#endif // __clang__
-
-// END macros to make my life easier
-
-
-/// Warn about things that will change when compiling
-/// with an ABI-compliant compiler
-// see note about -fabi-version=6 in the makefile
-E("-Wabi")
-
-/// Warn if a subobject has an abi_tag attribute that
-/// the complete object type does not have
-WG48("-Wabi-tag")
-
-/// Warn about suspicious uses of memory addresses
-E("-Waddress")
-
-/// Warn about returning structures, unions or arrays
-I("-Waggregate-return")
-
-/// Warn if an array is accessed out of bounds
-E("-Warray-bounds")
-
-/// Warn about inappropriate attribute usage
-E("-Wattributes")
-
-/// Warn when a built-in preprocessor macro is
-// undefined or redefined
-E("-Wbuiltin-macro-redefined")
-
-/// Warn about C++ constructs whose meaning differs
-/// between ISO C++ 1998 and ISO C++ 2011
-// This has gone funky lately. It probably doesn't do anything useful anyway.
-//E("-Wc++0x-compat")
-//W("-Wc++11-compat")
-I("-Wc++0x-compat")
-
-// I care about whether my code compiles with the standard as implemented
-// by certain compilers, not whether it matches with an *exact* standard.
-#ifdef __clang__
-# if __has_warning("-Wc++1y-extensions")
-IC("-Wc++1y-extensions")
-# else
-static_assert('E', "-Wc++1y-extensions not in this clang version");
-# endif
+DIAG_W(deprecated_declarations);
+#endif
+DIAG_W(disabled_optimization);
+DIAG_E(div_by_zero);
+DIAG_W(documentation);
+DIAG_I(double_promotion);
+DIAG_I(effcxx);
+DIAG_E(empty_body);
+DIAG_E(endif_labels);
+DIAG_E(enum_compare);
+DIAG_E(extra_semi);
+DIAG_E(float_equal);
+DIAG_E(format);
+DIAG_E(format_contains_nul);
+DIAG_E(format_extra_args);
+#if CLANG
+DIAG_I(format_nonliteral);
+DIAG_I(format_security);
#else
-static_assert('E', "-Wc++1y-extensions not in GCC");
+DIAG_E(format_nonliteral);
+DIAG_E(format_security);
#endif
-
-/// Warn about pointer casts which increase alignment
-E("-Wcast-align")
-
-/// Warn about casts which discard qualifiers
-E("-Wcast-qual")
-
-/// Warn about subscripts whose type is "char"
-E("-Wchar-subscripts")
-
-/// Warn about variables that might be changed by
-/// "longjmp" or "vfork"
-EG("-Wclobbered")
-
-/// Warn about possibly nested block comments, and
-/// C++ comments spanning more than one physical line
-E("-Wcomment")
-
-/// Warn for conditionally-supported constructs
-EG49("-Wconditionally-supported")
-
-// A fixable difference between c++11 and c++14
-#ifdef __clang__
-# if __has_warning("-Wconstexpr-not-const")
-EC("-Wconstexpr-not-const")
-# else
-static_assert('E', "-Wconstexpr-not-const not in this clang version");
-# endif
+DIAG_E(format_y2k);
+DIAG_I(format_zero_length);
+DIAG_E(free_nonheap_object);
+DIAG_E(gnu_designator);
+DIAG_E(ignored_qualifiers);
+DIAG_E(implicit_fallthrough);
+DIAG_W(inherited_variadic_ctor);
+DIAG_E(init_self);
+DIAG_X(inline);
+DIAG_E(int_to_pointer_cast);
+DIAG_W(invalid_memory_model);
+DIAG_E(invalid_offsetof);
+DIAG_E(invalid_pch);
+DIAG_W(literal_suffix);
+DIAG_W(logical_op);
+DIAG_I(long_long);
+DIAG_E(main);
+DIAG_E(maybe_uninitialized);
+DIAG_I(mismatched_tags);
+DIAG_E(missing_braces);
+DIAG_E(missing_declarations);
+#if GCC
+DIAG_I(missing_field_initializers);
#else
-static_assert('E', "-Wconstexpr-not-const not in GCC");
+DIAG_E(missing_field_initializers);
#endif
-
-/// Warn for implicit type conversions that may
-/// change a value
-X("-Wconversion")
-
-/// Warn for converting NULL from/to a non-pointer
-/// type
-E("-Wconversion-null")
-
-/// Warn in case profiles in -fprofile-use do not
-/// match
-WG("-Wcoverage-mismatch")
-
-///
-EC("-Wcovered-switch-default")
-
-/// Warn when a #warning directive is encountered
-WG("-Wcpp")
-
-/// Warn when all constructors and destructors are
-/// private
-E("-Wctor-dtor-privacy")
-
-/// Warn about __TIME__, __DATE__ and __TIMESTAMP__
-/// usage
-EG49("-Wdate-time")
-
-/// Warn when deleting a pointer to incomplete type
-EG49("-Wdelete-incomplete")
-
-/// Warn about deleting polymorphic objects with non-
-/// virtual destructors
-E47("-Wdelete-non-virtual-dtor")
-
-/// Warn if a deprecated compiler feature, class,
-/// method, or field is used
-W("-Wdeprecated")
-
-/// Warn about uses of __attribute__((deprecated)")
-/// declarations
-W("-Wdeprecated-declarations")
-#ifdef QUIET
-I("-Wdeprecated-declarations")
+DIAG_E(missing_format_attribute);
+DIAG_E(missing_include_dirs);
+DIAG_W(missing_noreturn);
+DIAG_E(missing_prototypes);
+#ifndef GTEST_HAS_PTHREAD // this is a hack
+DIAG_E(missing_variable_declarations);
+#else
+DIAG_I(missing_variable_declarations);
#endif
-
-/// Warn when an optimization pass is disabled
-W("-Wdisabled-optimization")
-
-/// Warn about compile-time integer division by zero
-E("-Wdiv-by-zero")
-
-///
-WC("-Wdocumentation")
-
-/// Warn about implicit conversions from "float" to
-/// "double"
-IG("-Wdouble-promotion")
-
-/// Warn about violations of Effective C++ style rules
-I("-Weffc++")
-
-/// Warn about an empty body in an if or else
-/// statement
-E("-Wempty-body")
-
-/// Warn about stray tokens after #elif and #endif
-E("-Wendif-labels")
-
-/// Warn about comparison of different enum types
-E("-Wenum-compare")
-
-///
-EC("-Wextra-semi")
-
-/// Warn if testing floating point numbers for
-/// equality
-E("-Wfloat-equal")
-
-/// Warn about printf/scanf/strftime/strfmon format
-/// string anomalies
-// see below
-EG("-Wformat")
-// but gcc 4.8 warns on %ms, since we enabled -Wpedantic.
-//WG48("-Wformat")
-
-/// Warn about format strings that contain NUL bytes
-EG("-Wformat-contains-nul")
-
-/// Warn if passing too many arguments to a function
-/// for its format string
-E("-Wformat-extra-args")
-
-/// Warn about format strings that are not literals
-EG("-Wformat-nonliteral")
-// Available in clang, but not smart enough to handle constexpr.
-IC("-Wformat-nonliteral")
-
-/// Warn about possible security problems with format
-/// functions
-EG("-Wformat-security")
-// Same.
-IC("-Wformat-security")
-
-/// Warn about strftime formats yielding 2-digit years
-E("-Wformat-y2k")
-
-/// Warn about zero-length formats
-I("-Wformat-zero-length")
-
-/// Warn when attempting to free a non-heap object
-EG47("-Wfree-nonheap-object")
-
-// -Wgnu is a clang alias for -Wpedantic
-
-// Foo{x: y}
-EC("-Wgnu-designator")
-
-
-/// Warn whenever type qualifiers are ignored.
-E("-Wignored-qualifiers")
-
-///
-EC("-Wimplicit-fallthrough")
-
-/// Warn about C++11 inheriting constructors when the
-/// base has a variadic constructor
-WG48("-Winherited-variadic-ctor")
-
-/// Warn about variables which are initialized to
-/// themselves
-E("-Winit-self")
-
-/// Warn when an inlined function cannot be inlined
-X("-Winline")
-
-/// Warn when there is a cast to a pointer from an
-/// integer of a different size
-E("-Wint-to-pointer-cast")
-
-/// Warn when an atomic memory model parameter is
-/// known to be outside the valid range.
-WG47("-Winvalid-memory-model")
-
-/// Warn about invalid uses of the "offsetof" macro
-E("-Winvalid-offsetof")
-
-/// Warn about PCH files that are found but not used
-E("-Winvalid-pch")
-
-/// Warn when a string or character literal is
-/// followed by a ud-suffix which does not begin with
-/// an underscore.
-WG48("-Wliteral-suffix")
-
-/// Warn when a logical operator is suspiciously
-/// always evaluating to true or false
-WG("-Wlogical-op")
-
-/// Do not warn about using "long long" when -pedantic
-I("-Wlong-long")
-
-/// Warn about suspicious declarations of "main"
-E("-Wmain")
-
-/// Warn about maybe uninitialized automatic variables
-EG47("-Wmaybe-uninitialized")
-
-// bitch about 'struct Foo' vs 'class Foo'
-IC("-Wmismatched-tags")
-
-/// Warn about possibly missing braces around
-/// initializers
-// beware of things like std::array!
-E("-Wmissing-braces")
-
-/// Warn about global functions without previous
-/// declarations
-// This doesn't work for clang, it wants -Wmissing-prototypes instead.
-E("-Wmissing-declarations")
-
-/// Warn about missing fields in struct initializers
-// Actually supported by GCC, but gives warnings when I don't want, e.g.:
-// Foo foo = {};
-EC("-Wmissing-field-initializers")
-IG("-Wmissing-field-initializers")
-
-/// Warn about functions which might be candidates
-/// for format attributes
-E("-Wmissing-format-attribute")
-
-/// Warn about user-specified include directories
-/// that do not exist
-E("-Wmissing-include-dirs")
-
-/// Warn about functions which might be candidates
-/// for __attribute__((noreturn)")
-W("-Wmissing-noreturn")
-
-// clang uses this instead of -Wmissing-declarations
-EC("-Wmissing-prototypes")
-
-///
-// like -Wmissing-declarations but for variables instead of functions
+DIAG_E(mudflap);
+DIAG_E(multichar);
+DIAG_E(narrowing);
+DIAG_W(noexcept);
+DIAG_E(non_template_friend);
+DIAG_E(non_virtual_dtor);
+DIAG_E(nonnull);
+DIAG_E(null_conversion);
+DIAG_E(old_style_cast);
+DIAG_W(overflow);
+DIAG_E(openmp_simd);
+DIAG_E(overloaded_virtual);
+DIAG_E(packed);
+DIAG_W(packed_bitfield_compat);
+DIAG_I(padded);
+DIAG_E(parentheses);
+DIAG_I(pedantic);
+DIAG_E(pmf_conversions);
+DIAG_E(pointer_arith);
+DIAG_E(pragmas);
+DIAG_W(redundant_decls);
+DIAG_E(reorder);
+DIAG_W(return_local_addr);
+DIAG_E(return_type);
+DIAG_E(sequence_point);
+DIAG_E(shadow);
+DIAG_X(sign_compare);
+DIAG_E(sign_promo);
+DIAG_W(sizeof_pointer_memaccess);
+DIAG_X(stack_protector);
+DIAG_E(strict_aliasing);
+DIAG_W(strict_null_sentinel);
+DIAG_X(strict_overflow);
+DIAG_I(switch);
+DIAG_I(switch_default);
+DIAG_I(switch_enum);
+DIAG_W(sync_nand);
+DIAG_E(trampolines);
+DIAG_E(trigraphs);
+DIAG_E(type_limits);
+DIAG_E(undef);
+DIAG_E(uninitialized);
+DIAG_E(unknown_pragmas);
+DIAG_W(unreachable_code);
+DIAG_X(unsafe_loop_optimizations);
+DIAG_E(unused_but_set_parameter);
+DIAG_E(unused_but_set_variable);
+DIAG_E(unused_function);
+DIAG_E(unused_label);
+DIAG_E(unused_local_typedefs);
+DIAG_W(unused_macros);
+DIAG_E(unused_parameter);
+DIAG_E(unused_result);
+DIAG_E(unused_value);
+DIAG_E(unused_variable);
+DIAG_E(useless_cast);
+DIAG_E(varargs);
+DIAG_W(variadic_macros);
+DIAG_W(vector_operation_performance);
+DIAG_E(virtual_move_assign);
+DIAG_I(vla);
+DIAG_E(volatile_register_var);
+DIAG_E(write_strings);
#ifndef GTEST_HAS_PTHREAD // this is a hack
-EC("-Wmissing-variable-declarations")
+DIAG_E(zero_as_null_pointer_constant);
+#else
+DIAG_I(zero_as_null_pointer_constant);
#endif
-
-/// Warn about constructs not instrumented by
-/// -fmudflap
-EG("-Wmudflap")
-
-/// Warn about use of multi-character character
-/// constants
-E("-Wmultichar")
-
-/// Warn about narrowing conversions within { } that
-/// are ill-formed in C++11
-EG47("-Wnarrowing")
-
-/// Warn when a noexcept expression evaluates to
-/// false even though the expression can't actually
-/// throw
-WG("-Wnoexcept")
-
-/// Warn when non-templatized friend functions are
-/// declared within a template
-EG("-Wnon-template-friend")
-
-/// Warn about non-virtual destructors
-E("-Wnon-virtual-dtor")
-
-/// Warn about NULL being passed to argument slots
-/// marked as requiring non-NULL
-E("-Wnonnull")
-
-///
-EC("-Wnull-conversion")
-
-/// Warn if a C-style cast is used in a program
-E("-Wold-style-cast")
-
-/// Warn about overflow in arithmetic expressions
-W("-Woverflow")
-
-/// Warn if a simd directive is overridden by the
-/// vectorizer cost model
-EG49("-Wopenmp-simd")
-
-/// Warn if a string is longer than the maximum
-/// portable length specified by the standard
-//X("-Woverlength-strings")
-
-/// Warn about overloaded virtual function names
-E("-Woverloaded-virtual")
-
-/// Warn when the packed attribute has no effect on
-/// struct layout
-E("-Wpacked")
-
-/// Warn about packed bit-fields whose offset changed
-/// in GCC 4.4
-WG("-Wpacked-bitfield-compat")
-
-/// Warn when padding is required to align structure
-/// members
-I("-Wpadded")
-
-/// Warn about possibly missing parentheses
-E("-Wparentheses")
-
-/// Issue warnings needed for strict compliance to
-/// the standard
-//EG48("-Wpedantic")
-// lots of minor extensions are used
-IG48("-Wpedantic")
-// a bit too noisy
-EC("-Wpedantic")
-
-/// Warn when converting the type of pointers to
-/// member functions
-EG("-Wpmf-conversions")
-
-/// Warn about function pointer arithmetic
-E("-Wpointer-arith")
-
-/// Warn about misuses of pragmas
-EG("-Wpragmas")
-
-/// Warn about multiple declarations of the same
-/// object
-W("-Wredundant-decls")
-
-/// Warn when the compiler reorders code
-E("-Wreorder")
-
-/// Warn about returning a pointer/reference to a
-/// local or temporary variable.
-WG48("-Wreturn-local-addr")
-
-/// Warn whenever a function's return type defaults
-/// to "int" (C), or about inconsistent return types
-/// (C++")
-E("-Wreturn-type")
-
-/// Warn about possible violations of sequence point
-/// rules
-E("-Wsequence-point")
-
-/// Warn when one local variable shadows another
-E("-Wshadow")
-
-/// Warn about signed-unsigned comparisons
-X("-Wsign-compare")
-
-/// Warn when overload promotes from unsigned to
-/// signed
-E("-Wsign-promo")
-
-/// This switch lacks documentation
-WG48("-Wsizeof-pointer-memaccess")
-
-/// Warn when not issuing stack smashing protection
-/// for some reason
-X("-Wstack-protector")
-
-/// Warn about code which might break strict aliasing
-/// rules
-E("-Wstrict-aliasing")
-
-/// Warn about uncasted NULL used as sentinel
-WG("-Wstrict-null-sentinel")
-
-/// Warn about optimizations that assume that signed
-/// overflow is undefined
-X("-Wstrict-overflow")
-
-/// Warn about enumerated switches, with no default,
-/// missing a case
-I("-Wswitch")
-
-/// Warn about enumerated switches missing a
-/// "default:" statement
-I("-Wswitch-default")
-
-/// Warn about all enumerated switches missing a
-/// specific case
-I("-Wswitch-enum")
-
-/// Warn when __sync_fetch_and_nand and
-/// __sync_nand_and_fetch built-in functions are used
-WG("-Wsync-nand")
-
-/// Warn whenever a trampoline is generated
-EG("-Wtrampolines")
-
-/// Warn if trigraphs are encountered that might
-/// affect the meaning of the program
-E("-Wtrigraphs")
-
-/// Warn if a comparison is always true or always
-/// false due to the limited range of the data type
-E("-Wtype-limits")
-
-/// Warn if an undefined macro is used in an #if
-/// directive
-E("-Wundef")
-
-/// Warn about uninitialized automatic variables
-E("-Wuninitialized")
-
-/// Warn about unrecognized pragmas
-E("-Wunknown-pragmas")
-
-///
-// Not an error because of some remaining enum+default
-WC("-Wunreachable-code")
-
-/// Warn if the loop cannot be optimized due to
-/// nontrivial assumptions.
-XG("-Wunsafe-loop-optimizations")
-
-/// Warn when a function parameter is only set,
-/// otherwise unused
-EG("-Wunused-but-set-parameter")
-
-/// Warn when a variable is only set, otherwise unused
-EG("-Wunused-but-set-variable")
-
-/// Warn when a function is unused
-E("-Wunused-function")
-
-/// Warn when a label is unused
-E("-Wunused-label")
-
-/// Warn when typedefs locally defined in a function
-/// are not used
-EG47("-Wunused-local-typedefs")
-
-/// Warn about macros defined in the main file that
-/// are not used
-W("-Wunused-macros")
-
-/// Warn when a function parameter is unused
-E("-Wunused-parameter")
-
-/// Warn if a caller of a function, marked with
-/// attribute warn_unused_result, does not use its
-/// return value
-E("-Wunused-result")
-
-/// Warn when an expression value is unused
-E("-Wunused-value")
-
-/// Warn when a variable is unused
-E("-Wunused-variable")
-
-/// Warn about useless casts
-EG48("-Wuseless-cast")
-
-/// Warn about questionable usage of the macros used
-/// to retrieve variable arguments
-EG48("-Wvarargs")
-
-/// Warn about using variadic macros
-W("-Wvariadic-macros")
-
-/// Warn when a vector operation is compiled
-/// outside the SIMD
-WG47("-Wvector-operation-performance")
-
-/// Warn if a virtual base has a non-trivial move
-/// assignment operator
-EG48("-Wvirtual-move-assign")
-
-/// Warn if a variable length array is used
-I("-Wvla")
-
-/// Warn when a register variable is declared volatile
-E("-Wvolatile-register-var")
-
-/// In C++, nonzero means warn about deprecated
-/// conversion from string literals to 'char *'. In
-/// C, similar warning, except that the conversion is
-/// of course not deprecated by the ISO C standard.
-E("-Wwrite-strings")
-
-/// Warn when a literal '0' is used as null
-/// pointer
-EG47("-Wzero-as-null-pointer-constant")
-
-
-// clean up after myself
-#undef P
-
-#undef I
-#undef W
-#undef E
-#undef X
-
-#undef IC
-#undef WC
-#undef EC
-#undef XC
-
-#undef IG
-#undef WG
-#undef EG
-#undef XG
-
-#undef IG47
-#undef WG47
-#undef EG47
-#undef XG47
-
-#undef IG48
-#undef WG48
-#undef EG48
-#undef XG48
-
-#undef I47
-#undef W47
-#undef E47
-#undef X47
-
-#undef I48
-#undef W48
-#undef E48
-#undef X48
} // namespace tmwa