summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure60
-rw-r--r--configure.in10
-rw-r--r--src/char/inter.h2
-rw-r--r--src/char/loginif.c1
-rw-r--r--src/map/chrif.c4
5 files changed, 72 insertions, 5 deletions
diff --git a/configure b/configure
index b8f8f41f6..03f0dca11 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in 8dc7572.
+# From configure.in fd7cd2c.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69.
#
@@ -4570,10 +4570,17 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# -Wcast-qual use for check wrong casts. It cant be added by default, because some casts must be wrong.
# -Wconversion warning: conversion to 'long unsigned int' from 'int' may change the sign of the result
# -Wfloat-equal comparing floating point with == or != is unsafe
+# -Wpedantic different pedantic checks. Not all can be fixed in nice way.
+# attributes suggestion
+# -Wsuggest-attribute=const -Wsuggest-attribute=format -Wsuggest-attribute=pure
+
# flags what can be used but now return no warnings: -Warray-bounds -Wbool-compare -Wcast-align
# -Wchar-subscripts -Wchkp -Wclobbered -Wcomment -Wdisabled-optimization -Wempty-body
# -Werror-implicit-function-declaration -Wignored-qualifiers
-# -Winit-self
+# -Wjump-misses-init -Wlogical-op -Wmissing-field-initializers -Wmissing-parameter-type
+# -Wnested-externs -Wold-style-declaration -Wold-style-definition -Woverlength-strings -Woverride-init
+# -Wredundant-decls -Wstack-protector -Wstrict-prototypes
+# -Winit-self -Wpointer-arith
CFLAGS="$CFLAGS -pipe -ffast-math -Wall -Wextra -Wno-sign-compare"
CPPFLAGS="$CPPFLAGS -I../common"
@@ -6657,6 +6664,55 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wsuggest-attribute=noreturn" >&5
+$as_echo_n "checking whether $CC supports -Wsuggest-attribute=noreturn... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror -Wsuggest-attribute=noreturn"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ CFLAGS="$OLD_CFLAGS -Wsuggest-attribute=noreturn"
+ # Optionally, run a test
+ if test "x" != "x"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wsuggest-attribute=noreturn" >&5
+$as_echo_n "checking whether $CC can actually use -Wsuggest-attribute=noreturn... " >&6; }
+ CFLAGS="$OLD_CFLAGS -Werror -Wsuggest-attribute=noreturn"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ CFLAGS="$OLD_CFLAGS"
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ CFLAGS="$OLD_CFLAGS -Wsuggest-attribute=noreturn"
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ CFLAGS="$OLD_CFLAGS"
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-format-nonliteral" >&5
$as_echo_n "checking whether $CC supports -Wno-format-nonliteral... " >&6; }
OLD_CFLAGS="$CFLAGS"
diff --git a/configure.in b/configure.in
index 9618113eb..e23b6c44b 100644
--- a/configure.in
+++ b/configure.in
@@ -459,10 +459,17 @@ AC_LANG([C])
# -Wcast-qual use for check wrong casts. It cant be added by default, because some casts must be wrong.
# -Wconversion warning: conversion to 'long unsigned int' from 'int' may change the sign of the result
# -Wfloat-equal comparing floating point with == or != is unsafe
+# -Wpedantic different pedantic checks. Not all can be fixed in nice way.
+# attributes suggestion
+# -Wsuggest-attribute=const -Wsuggest-attribute=format -Wsuggest-attribute=pure
+
# flags what can be used but now return no warnings: -Warray-bounds -Wbool-compare -Wcast-align
# -Wchar-subscripts -Wchkp -Wclobbered -Wcomment -Wdisabled-optimization -Wempty-body
# -Werror-implicit-function-declaration -Wignored-qualifiers
-# -Winit-self
+# -Wjump-misses-init -Wlogical-op -Wmissing-field-initializers -Wmissing-parameter-type
+# -Wnested-externs -Wold-style-declaration -Wold-style-definition -Woverlength-strings -Woverride-init
+# -Wredundant-decls -Wstack-protector -Wstrict-prototypes
+# -Winit-self -Wpointer-arith
CFLAGS="$CFLAGS -pipe -ffast-math -Wall -Wextra -Wno-sign-compare"
CPPFLAGS="$CPPFLAGS -I../common"
@@ -811,6 +818,7 @@ AC_CHECK_COMPILER_WFLAG(format)
AC_CHECK_COMPILER_WFLAG(format-signedness)
AC_CHECK_COMPILER_WFLAG(format-y2k)
AC_CHECK_COMPILER_WFLAG(missing-include-dirs)
+AC_CHECK_COMPILER_WFLAG(suggest-attribute=noreturn)
AC_CHECK_COMPILER_WNOFLAG(format-nonliteral)
AC_CHECK_COMPILER_WNOFLAG(switch)
AC_CHECK_COMPILER_WNOFLAG(missing-field-initializers)
diff --git a/src/char/inter.h b/src/char/inter.h
index 49eca1256..b8bcb2def 100644
--- a/src/char/inter.h
+++ b/src/char/inter.h
@@ -37,7 +37,7 @@ struct inter_interface {
void (*do_final_msg) (void);
const char* (*job_name) (int class_);
void (*vmsg_to_fd) (int fd, int u_fd, int aid, char* msg, va_list ap);
- void (*msg_to_fd) (int fd, int u_fd, int aid, char *msg, ...);
+ void (*msg_to_fd) (int fd, int u_fd, int aid, char *msg, ...) __attribute__((format(printf, 4, 5)));
void (*savereg) (int account_id, int char_id, const char *key, unsigned int index, intptr_t val, bool is_string);
int (*accreg_fromsql) (int account_id,int char_id, int fd, int type);
int (*config_read) (const char* cfgName);
diff --git a/src/char/loginif.c b/src/char/loginif.c
index c577ad791..1e457fcca 100644
--- a/src/char/loginif.c
+++ b/src/char/loginif.c
@@ -39,6 +39,7 @@ struct loginif_interface loginif_s;
struct loginif_interface *loginif;
/// Resets all the data.
+void loginif_reset(void) __attribute__ ((noreturn));
void loginif_reset(void)
{
int id;
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 412d8d36a..4de82ef07 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -110,7 +110,9 @@ struct chrif_interface *chrif;
#define chrif_check(a) do { if(!chrif->isconnected()) return a; } while(0)
/// Resets all the data.
-void chrif_reset(void) {
+void chrif_reset(void) __attribute__ ((noreturn));
+void chrif_reset(void)
+{
// TODO kick everyone out and reset everything [FlavioJS]
exit(EXIT_FAILURE);
}