summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-01-08 19:00:34 -0800
committerBen Longbons <b.r.longbons@gmail.com>2013-01-08 19:54:26 -0800
commitf2fd4885c2a906414e0f36acf95d252e5a9d5805 (patch)
tree918bff247135e9223a5126f1b85f4ae4fc9ba1aa /src/common
parent3e42921c657bc93094f0c7d96855aae9b0be5a7e (diff)
downloadtmwa-f2fd4885c2a906414e0f36acf95d252e5a9d5805.tar.gz
tmwa-f2fd4885c2a906414e0f36acf95d252e5a9d5805.tar.bz2
tmwa-f2fd4885c2a906414e0f36acf95d252e5a9d5805.tar.xz
tmwa-f2fd4885c2a906414e0f36acf95d252e5a9d5805.zip
Improve warning management more
Diffstat (limited to 'src/common')
-rw-r--r--src/common/const_array.hpp1
-rw-r--r--src/common/core.cpp2
-rw-r--r--src/common/cxxstdio.hpp59
-rw-r--r--src/common/db.cpp2
-rw-r--r--src/common/sanity.hpp1
-rw-r--r--src/common/socket.cpp2
-rw-r--r--src/common/utils.cpp1
-rw-r--r--src/common/utils2.hpp12
8 files changed, 42 insertions, 38 deletions
diff --git a/src/common/const_array.hpp b/src/common/const_array.hpp
index 12c5d6f..eb0da58 100644
--- a/src/common/const_array.hpp
+++ b/src/common/const_array.hpp
@@ -29,7 +29,6 @@
#include <vector>
#ifdef ANNOYING_GCC46_WORKAROUNDS
-# warning "like this one"
// constexpr is buggy with templates in this version
# define constexpr /* nothing */
#endif
diff --git a/src/common/core.cpp b/src/common/core.cpp
index a6a170b..ef953f8 100644
--- a/src/common/core.cpp
+++ b/src/common/core.cpp
@@ -46,7 +46,7 @@ void chld_proc(int)
{
wait(NULL);
}
-static
+static __attribute__((noreturn))
void sig_proc(int)
{
for (int i = 1; i < 31; ++i)
diff --git a/src/common/cxxstdio.hpp b/src/common/cxxstdio.hpp
index d7c0634..866947c 100644
--- a/src/common/cxxstdio.hpp
+++ b/src/common/cxxstdio.hpp
@@ -67,6 +67,7 @@ namespace cxxstdio
return vsscanf(in, fmt, ap);
}
#else
+ inline
int do_vscan(const char *, const char *, va_list) = delete;
#endif
@@ -262,39 +263,39 @@ namespace cxxstdio
}
};
-#define FPRINTF(file, fmt, args...) \
- ([&]() -> int \
- { \
- struct format_impl \
- { \
- constexpr static \
- const char *print_format() { return fmt; } \
- }; \
- return cxxstdio::PrintFormatter<format_impl>::print(file, ## args);\
+#define FPRINTF(file, fmt, ...) \
+ ([&]() -> int \
+ { \
+ struct format_impl \
+ { \
+ constexpr static \
+ const char *print_format() { return fmt; } \
+ }; \
+ return cxxstdio::PrintFormatter<format_impl>::print(file, ## __VA_ARGS__); \
}())
-#define FSCANF(file, fmt, args...) \
- ([&]() -> int \
- { \
- struct format_impl \
- { \
- constexpr static \
- const char *scan_format() { return fmt; } \
- }; \
- return cxxstdio::ScanFormatter<format_impl>::scan(file, ## args); \
+#define FSCANF(file, fmt, ...) \
+ ([&]() -> int \
+ { \
+ struct format_impl \
+ { \
+ constexpr static \
+ const char *scan_format() { return fmt; } \
+ }; \
+ return cxxstdio::ScanFormatter<format_impl>::scan(file, ## __VA_ARGS__); \
}())
-#define PRINTF(fmt, args...) FPRINTF(stdout, fmt, ## args)
-#define SPRINTF(str, fmt, args...) FPRINTF(str, fmt, ## args)
-#define SCANF(fmt, args...) FSCANF(stdin, fmt, ## args)
-#define SSCANF(str, fmt, args...) FSCANF(str, fmt, ## args)
-
-#define STRPRINTF(fmt, args...) \
- ([&]() -> std::string \
- { \
- std::string _out_impl; \
- SPRINTF(_out_impl, fmt, ## args); \
- return _out_impl; \
+#define PRINTF(fmt, ...) FPRINTF(stdout, fmt, ## __VA_ARGS__)
+#define SPRINTF(str, fmt, ...) FPRINTF(str, fmt, ## __VA_ARGS__)
+#define SCANF(fmt, ...) FSCANF(stdin, fmt, ## __VA_ARGS__)
+#define SSCANF(str, fmt, ...) FSCANF(str, fmt, ## __VA_ARGS__)
+
+#define STRPRINTF(fmt, ...) \
+ ([&]() -> std::string \
+ { \
+ std::string _out_impl; \
+ SPRINTF(_out_impl, fmt, ## __VA_ARGS__);\
+ return _out_impl; \
}())
} // namespace cxxstdio
diff --git a/src/common/db.cpp b/src/common/db.cpp
index 06f85bc..448bfef 100644
--- a/src/common/db.cpp
+++ b/src/common/db.cpp
@@ -6,8 +6,6 @@
#include "utils.hpp"
-#define ROOT_SIZE 4096
-
static
int strdb_cmp(struct dbt *table, const char *a, const char* b)
{
diff --git a/src/common/sanity.hpp b/src/common/sanity.hpp
index 9bad464..e6f2807 100644
--- a/src/common/sanity.hpp
+++ b/src/common/sanity.hpp
@@ -18,7 +18,6 @@
# error "Please upgrade to at least GCC 4.6"
# endif
# if __GNUC_MINOR__ == 6
-# warning "Working around some annoying bugs in GCC 4.6 ..."
# define ANNOYING_GCC46_WORKAROUNDS
# endif
# endif
diff --git a/src/common/socket.cpp b/src/common/socket.cpp
index d3485d3..023a856 100644
--- a/src/common/socket.cpp
+++ b/src/common/socket.cpp
@@ -18,8 +18,10 @@
#include "mmo.hpp"
#include "utils.hpp"
+static
fd_set readfds;
int fd_max;
+static
int currentuse;
const uint32_t RFIFO_SIZE = 65536;
diff --git a/src/common/utils.cpp b/src/common/utils.cpp
index d8c0c12..d24c0a9 100644
--- a/src/common/utils.cpp
+++ b/src/common/utils.cpp
@@ -59,7 +59,6 @@ int e_mail_check(const char *email)
if (strchr(last_arobas, ch) != NULL)
{
return 0;
- break;
}
}
diff --git a/src/common/utils2.hpp b/src/common/utils2.hpp
index 7b2bc4a..3b652d5 100644
--- a/src/common/utils2.hpp
+++ b/src/common/utils2.hpp
@@ -4,6 +4,12 @@
#include <iterator>
#include <type_traits>
+#ifdef __clang__
+# define FALLTHROUGH [[clang::fallthrough]]
+#else
+# define FALLTHROUGH /* fallthrough */
+#endif
+
template<class T, class E, E max>
struct earray
{
@@ -109,19 +115,19 @@ struct remove_enum<E, true>
inline \
E operator & (E l, E r) \
{ \
- typedef typename underlying_type<E>::type U;\
+ typedef underlying_type<E>::type U; \
return E(U(l) & U(r)); \
} \
inline \
E operator | (E l, E r) \
{ \
- typedef typename underlying_type<E>::type U;\
+ typedef underlying_type<E>::type U; \
return E(U(l) | U(r)); \
} \
inline \
E operator ^ (E l, E r) \
{ \
- typedef typename underlying_type<E>::type U;\
+ typedef underlying_type<E>::type U; \
return E(U(l) ^ U(r)); \
} \
inline \