소스 검색

* Fixup some g++ 4.3.2-1 warnings

svn: 3887
Bryan Drewery 17 년 전
부모
커밋
32841db32e
20개의 변경된 파일73개의 추가작업 그리고 50개의 파일을 삭제
  1. 4 4
      Makefile.in
  2. 3 1
      autotools/includes/depend.m4
  3. 19 10
      configure
  4. 3 3
      src/binary.c
  5. 3 3
      src/botcmd.c
  6. 1 1
      src/botnet.c
  7. 4 2
      src/chanprog.c
  8. 1 1
      src/cmds.c
  9. 1 1
      src/main.c
  10. 1 0
      src/makeset.c
  11. 6 3
      src/match.c
  12. 2 1
      src/misc.c
  13. 5 5
      src/misc_file.c
  14. 2 1
      src/mod/channels.mod/userchan.c
  15. 4 4
      src/mod/irc.mod/cmdsirc.c
  16. 2 1
      src/mod/server.mod/server.c
  17. 4 4
      src/mod/server.mod/servmsg.c
  18. 2 1
      src/shell.c
  19. 4 3
      src/userent.c
  20. 2 1
      src/users.c

+ 4 - 4
Makefile.in

@@ -38,7 +38,7 @@ DIFF = @DIFF@
 #LIBS = @LIBS@ @ZLIB@ @SSL@ 
 LIBS = @LIBS@ @ZLIB@ 
 
-DEBCXXFLAGS = -DDEBUG -fno-inline -g3 -ggdb3 -O0
+DEBCXXFLAGS = -DDEBUG -fno-inline -g3 -ggdb3 -O0 -Wshadow -Wpointer-arith -Wcast-align @GCC3DEB@
 CFLGS = @GCC3@
 _CFLGS = -fno-strict-aliasing -W -Wformat \
 #-Wshadow -Wnested-externs -Wno-format-y2k \
@@ -61,16 +61,16 @@ MAKE_BIN = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CXX)' 'LD=$(LD)' \
 
 MAKE_DEBUG = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CCDEBUG)' 'LD=$(LDDEBUG) -g' \
 'CCDEPMODE=$(CCDEPMODE)' 'REVISION=$(REVISION)' 'BUILDTS=$(BUILDTS)' \
-'STRIP=touch' 'CFLGS=$(DEBCXXFLAGS) $(CFLGS)' \
+'STRIP=touch' 'CFLGS=$(CFLGS) $(DEBCXXFLAGS)' \
 'LIBS=$(LIBS)' 'EGGEXEC=$(BINEXEC)' 'EGGBUILD=(debug)' 
 
 MAKE_UTILS = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CCDEBUG)' 'STRIP=touch' \
 'CCDEPMODE=$(CCDEPMODE)' \
-'CFLGS=$(DEBCXXFLAGS) $(CFLGS)' 'LIBS=$(LIBS)' 'LD=$(LDDEBUG) -g'
+'CFLGS=$(CFLGS) $(DEBCXXFLAGS)' 'LIBS=$(LIBS)' 'LD=$(LDDEBUG) -g'
 
 MAKE_UTILS_NR = $(MAKE) 'CXX=$(CXX)' 'STRIP=touch' \
 'CCDEPMODE=$(CCDEPMODE)' \
-'CFLGS=$(DEBCXXFLAGS) $(CFLGS)' 'LIBS=$(LIBS)' 'LD=$(LD) -g'
+'CFLGS=$(CFLGS) $(DEBCXXFLAGS)' 'LIBS=$(LIBS)' 'LD=$(LD) -g'
 
 MAKE_CONFIG = $(MAKE) 'MAKE=$(MAKE)'
 

+ 3 - 1
autotools/includes/depend.m4

@@ -11,10 +11,12 @@ num=`$CXX -dumpversion | sed "s/^\\\(.\\\).*/\\\1/"`
 if test $num -ge "3"; then
   CCDEPMODE=gcc3
 #  GCC3="-Wpadded -Wpacked -Wno-unused-parameter -Wmissing-format-attribute -Wdisabled-optimization"
-  GCC3="-W -Wno-unused-parameter -Wdisabled-optimization -Wmissing-format-attribute -Wno-write-strings"
+  GCC3="-W -Wno-unused-parameter -Wdisabled-optimization -Wno-write-strings"
+  GCC3DEB="-Wno-disabled-optimization -Wmissing-format-attribute"
 fi
 AC_SUBST(CCDEPMODE)dnl
 AC_SUBST(GCC3)dnl
+AC_SUBST(GCC3DEB)dnl
 ])
 
 AC_DEFUN([DO_DEPS],

+ 19 - 10
configure

@@ -669,6 +669,7 @@ GREP
 EGREP
 CCDEPMODE
 GCC3
+GCC3DEB
 SET_MAKE
 HEAD_1
 AWK
@@ -3473,7 +3474,8 @@ num=`$CXX -dumpversion | sed "s/^\\\(.\\\).*/\\\1/"`
 if test $num -ge "3"; then
   CCDEPMODE=gcc3
 #  GCC3="-Wpadded -Wpacked -Wno-unused-parameter -Wmissing-format-attribute -Wdisabled-optimization"
-  GCC3="-W -Wno-unused-parameter -Wdisabled-optimization -Wmissing-format-attribute -Wno-write-strings"
+  GCC3="-W -Wno-unused-parameter -Wdisabled-optimization -Wno-write-strings"
+  GCC3DEB="-Wno-disabled-optimization -Wmissing-format-attribute"
 fi
 
 
@@ -9651,6 +9653,7 @@ cat >>conftest.$ac_ext <<_ACEOF
 # endif
 #endif
 
+#include <limits.h>
 #include <stdlib.h>
 
 #ifdef HAVE_UNISTD_H
@@ -9799,12 +9802,15 @@ main ()
      isn't worth using anyway.  */
   alarm (60);
 
-  for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
-    continue;
-  time_t_max--;
-  if ((time_t) -1 < 0)
-    for (time_t_min = -1; (time_t) (time_t_min * 2) < 0; time_t_min *= 2)
-      continue;
+  for (;;)
+    {
+      t = (time_t_max << 1) + 1;
+      if (t <= time_t_max)
+	break;
+      time_t_max = t;
+    }
+  time_t_min = - ((time_t) ~ (time_t) 0 == (time_t) -1) - time_t_max;
+
   delta = time_t_max / 997; /* a suitable prime number */
   for (i = 0; i < N_STRINGS; i++)
     {
@@ -9819,10 +9825,12 @@ main ()
 	     && mktime_test ((time_t) (60 * 60 * 24))))
 	return 1;
 
-      for (j = 1; 0 < j; j *= 2)
+      for (j = 1; ; j <<= 1)
 	if (! bigtime_test (j))
 	  return 1;
-      if (! bigtime_test (j - 1))
+	else if (INT_MAX / 2 < j)
+	  break;
+      if (! bigtime_test (INT_MAX))
 	return 1;
     }
   return ! (irix_6_4_bug () && spring_forward_gap () && year_2050_test ());
@@ -12593,6 +12601,7 @@ GREP!$GREP$ac_delim
 EGREP!$EGREP$ac_delim
 CCDEPMODE!$CCDEPMODE$ac_delim
 GCC3!$GCC3$ac_delim
+GCC3DEB!$GCC3DEB$ac_delim
 SET_MAKE!$SET_MAKE$ac_delim
 HEAD_1!$HEAD_1$ac_delim
 AWK!$AWK$ac_delim
@@ -12614,7 +12623,7 @@ MOD_UPDIR!$MOD_UPDIR$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 69; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 70; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

+ 3 - 3
src/binary.c

@@ -531,7 +531,7 @@ static bool check_bin_initialized(const char *fname)
   return 0;
 }
 
-void write_settings(const char *fname, int die, bool conf)
+void write_settings(const char *fname, int die, bool doconf)
 {
   char *hash = NULL;
   int bits = WRITE_CHECKSUM;
@@ -543,10 +543,10 @@ void write_settings(const char *fname, int die, bool conf)
    */
   if (!initialized)
     bits |= WRITE_PACK;
-  if (conf)
+  if (doconf)
     bits |= WRITE_CONF;
 
-  /* only bother writing anything if we have pack or conf, checksum is worthless to write out */
+  /* only bother writing anything if we have pack or doconf, checksum is worthless to write out */
   if (bits & (WRITE_PACK|WRITE_CONF)) {
     if ((hash = bin_checksum(fname, bits))) {
       printf(STR("* Wrote %ssettings to: %s.\n"), ((bits & WRITE_PACK) && !(bits & WRITE_CONF)) ? "pack " :

+ 3 - 3
src/botcmd.c

@@ -418,13 +418,13 @@ static void remote_tell_who(int idx, char *nick, int chan)
 
 static void bot_shellinfo(int idx, char *par)
 {
-  char *username = NULL, *sysname = NULL, *nodename = NULL, *arch = NULL, *version = NULL;
+  char *username = NULL, *sysname = NULL, *nodename = NULL, *arch = NULL, *botversion = NULL;
   
   username = newsplit(&par);
   sysname = newsplit(&par);
   nodename = newsplit(&par);
   arch = newsplit(&par);
-  version = newsplit(&par);
+  botversion = newsplit(&par);
 
   set_user(&USERENTRY_USERNAME, dcc[idx].user, username);
   set_user(&USERENTRY_OS, dcc[idx].user, sysname);
@@ -432,7 +432,7 @@ static void bot_shellinfo(int idx, char *par)
   strcpy(dcc[idx].u.bot->sysname, sysname); 
   set_user(&USERENTRY_NODENAME, dcc[idx].user, nodename);
   set_user(&USERENTRY_ARCH, dcc[idx].user, arch);
-  set_user(&USERENTRY_OSVER, dcc[idx].user, version);
+  set_user(&USERENTRY_OSVER, dcc[idx].user, botversion);
 }
 
 /* who <from@bot> <tobot> <chan#>

+ 1 - 1
src/botnet.c

@@ -880,7 +880,7 @@ int botunlink(int idx, const char *nick, const char *reason)
   if (nick[0] == '*')
     dprintf(idx, "%s\n", "Unlinking all bots...");
   for (i = 0; i < dcc_total; i++) {
-    if (dcc[i].type && (nick[0] == '*') || !egg_strcasecmp(dcc[i].nick, nick)) {
+    if (dcc[i].type && ((nick[0] == '*') || !egg_strcasecmp(dcc[i].nick, nick))) {
       if (dcc[i].type == &DCC_FORK_BOT) {
 	if (idx >= 0)
 	  dprintf(idx, "%s: %s -> %s.\n", "Killed link attempt to",

+ 4 - 2
src/chanprog.c

@@ -73,11 +73,13 @@ void rmspace(char *s)
   register char *p = NULL, *q = NULL;
 
   /* Remove trailing whitespaces. */
-  for (q = s + strlen(s) - 1; q >= s && egg_isspace(*q); q--);
+  for (q = s + strlen(s) - 1; q >= s && egg_isspace(*q); q--)
+    ;
   *(q + 1) = 0;
 
   /* Remove leading whitespaces. */
-  for (p = s; egg_isspace(*p); p++);
+  for (p = s; egg_isspace(*p); p++)
+    ;
 
   if (p != s)
     memmove(s, p, q - p + 2);

+ 1 - 1
src/cmds.c

@@ -1248,7 +1248,7 @@ static void cmd_chpass(int idx, char *par)
       }
     }
     if (strlen(pass) > MAXPASSLEN)
-      pass[MAXPASSLEN] = 0;
+      pass[MAXPASSLEN - 1] = 0;
 
     if (good) {
       set_user(&USERENTRY_PASS, u, pass);

+ 1 - 1
src/main.c

@@ -447,7 +447,7 @@ static void dtx_arg(int& argc, char *argv[])
     strlcpy(origbotname, argv[optind], HANDLEN + 1);
     strlcpy(origbotnick, argv[optind], HANDLEN + 1);
     /* Trim off .conf */
-    char *p = strchr(origbotname, '.');
+    p = strchr(origbotname, '.');
     if (p) {
       origbotname[(p - origbotname)] = 0;
       origbotnick[(p - origbotname)] = 0;

+ 1 - 0
src/makeset.c

@@ -3,6 +3,7 @@
 #include <string>
 #include <cctype>
 #include <algorithm>
+#include <cstring>
 using namespace std;
 
 int main(int argc, char *argv[]) {

+ 6 - 3
src/match.c

@@ -97,7 +97,8 @@ int _wild_match_per(register unsigned char *m, register unsigned char *n)
           return PERMATCH;      /* nonquoted * = match */
         break;
       case WILDP:
-        while (*(++m) == WILDP);        /* Zap redundant %s */
+        while (*(++m) == WILDP)
+          ;        /* Zap redundant %s */
         if (*m != WILDS) {      /* Don't both if next=* */
           if (*n != ' ') {      /* WILDS can't match ' ' */
             lpm = m;
@@ -170,9 +171,11 @@ int _wild_match(register unsigned char *m, register unsigned char *n)
   register int sofar = 0;
 
   /* find the end of each string */
-  while (*(++m));
+  while (*(++m))
+    ;
   m--;
-  while (*(++n));
+  while (*(++n))
+    ;
   n--;
 
   while (n >= na) {

+ 2 - 1
src/misc.c

@@ -261,7 +261,8 @@ void maskhost(const char *s, char *nw)
       nw += (f - q);
       strcpy(nw, mask_str);
     } else {
-      for (f = e; *f; f++);
+      for (f = e; *f; f++)
+        ;
       f--;
       if (*f >= '0' && *f <= '9') {	/* Numeric IP address */
 	while (*f != '.')

+ 5 - 5
src/misc_file.c

@@ -174,15 +174,15 @@ int fixmod(const char *s)
   return chmod(s, S_IRUSR | S_IWUSR | S_IXUSR);
 }
 
-Tempfile::Tempfile(const char *prefix, bool useFopen)
+Tempfile::Tempfile(const char *_prefix, bool _useFopen)
 {
-  this->useFopen = useFopen;
+  this->useFopen = _useFopen;
   this->f = NULL;
   this->fd = -1;
-  if (prefix) {
-    plen = strlen(prefix) + 1;
+  if (_prefix) {
+    plen = strlen(_prefix) + 1;
     this->prefix = new char[plen];
-    strlcpy(this->prefix, prefix, plen);
+    strlcpy(this->prefix, _prefix, plen);
   } else {
     this->prefix = NULL;
     plen = -1; /* to swallow the '-' */

+ 2 - 1
src/mod/channels.mod/userchan.c

@@ -258,7 +258,8 @@ int u_delmask(char type, struct chanset_t *c, char *who, int doit)
       j--;		/* our list starts at 0 */
       if (c)
         j -= n_mask;	/* subtract out the globals as the number given is globals+j */
-      for (; (*u) && j; u = &((*u)->next), j--);
+      for (; (*u) && j; u = &((*u)->next), j--) 
+        ;
       if (*u) {
         strlcpy(temp, (*u)->mask, sizeof temp);
         i = 1;

+ 4 - 4
src/mod/irc.mod/cmdsirc.c

@@ -796,10 +796,10 @@ static void cmd_mmode(int idx, char *par)
 
   int overlap = (force_overlap ? force_overlap : 1);
   int needed_modes = (overlap * targetcount);
-  int max_modes = ((force_bots ? force_bots : chanbotcount) * (force_alines ? force_alines : default_alines) * modesperline);
+  int my_max_modes = ((force_bots ? force_bots : chanbotcount) * (force_alines ? force_alines : default_alines) * modesperline);
 
-  if (needed_modes > max_modes) {
-    dprintf(idx, "Need to make %d modes, but the max is %d.\n", needed_modes, max_modes);
+  if (needed_modes > my_max_modes) {
+    dprintf(idx, "Need to make %d modes, but the max is %d.\n", needed_modes, my_max_modes);
     dprintf(idx, "Try increasing [alines] or decreasing [overlap].\n");
     if (overlap == 1)
       dprintf(idx, "Not enough bots.\n");
@@ -925,7 +925,7 @@ static void cmd_mmode(int idx, char *par)
   /* QUEUE *ALL*, then dump */
 
   while (bots) {
-    char *work = work_list[bpos];
+    work = work_list[bpos];
 
     if (simul)
       dprintf(idx, "%-10s MODE %s %s\n", local ? botname : chanbots[bpos]->nick, mode, work);

+ 2 - 1
src/mod/server.mod/server.c

@@ -648,7 +648,8 @@ void add_server(char *ss)
 #endif /* USE_IPV6 */
   char *p = NULL, *q = NULL;
 
-  for (z = serverlist; z && z->next; z = z->next);
+  for (z = serverlist; z && z->next; z = z->next)
+    ;
   while (ss) {
     p = strchr(ss, ',');
     if (p)

+ 4 - 4
src/mod/server.mod/servmsg.c

@@ -1091,10 +1091,10 @@ static void disconnect_server(int idx, int dolost)
   }
 
   /* Invalidate the cmd_swhois cache callback data */
-  for (int idx = 0; idx < dcc_total; idx++) {
-    if (dcc[idx].type && dcc[idx].whois[0]) {
-      dcc[idx].whois[0] = 0;
-      dcc[idx].whowas = 0;
+  for (int i = 0; i < dcc_total; i++) {
+    if (dcc[i].type && dcc[i].whois[0]) {
+      dcc[i].whois[0] = 0;
+      dcc[i].whowas = 0;
     }
   }
 }

+ 2 - 1
src/shell.c

@@ -143,11 +143,12 @@ void check_maxfiles()
     sdprintf("SOCK: %d BOGUS: %d SOCKS_TOTAL: %d", sock, bogus, socks_total);
 
     for (int i = 10; i < sock; i++)	/* dont close lower sockets, they're probably legit */
-      if (!findanysnum(i))
+      if (!findanysnum(i)) {
         if ((close(i)) == -1)			/* try to close the BOGUS fd (likely a KQUEUE) */
           failed_close++;
         else
           bogus--;
+      }
     if (bogus >= 150 || failed_close >= 50) {
       if (tands > 0) {
         botnet_send_chat(-1, conf.bot->nick, "Max FD reached, restarting...");

+ 4 - 3
src/userent.c

@@ -473,7 +473,7 @@ struct user_entry_type USERENTRY_ARCH = {
  "ARCH"
 };
 
-void stats_add(struct userrec *u, int login, int op)
+void stats_add(struct userrec *u, int islogin, int op)
 {
   if (!u || u->bot)
     return;
@@ -492,7 +492,7 @@ void stats_add(struct userrec *u, int login, int op)
   } else
     so = 0;
   sl = atoi(s2);
-  if (login)
+  if (islogin)
     sl++;
   if (op)
     so++;
@@ -1024,7 +1024,8 @@ struct user_entry_type USERENTRY_HOSTS =
 
 bool list_append(struct list_type **h, struct list_type *i)
 {
-  for (; *h; h = &((*h)->next));
+  for (; *h; h = &((*h)->next))
+    ;
   *h = i;
   return 1;
 }

+ 2 - 1
src/users.c

@@ -89,7 +89,8 @@ char *delignore(char *ign)
   static char temp[256] = "";
 
   if (!strchr(ign, '!') && (j = atoi(ign))) {
-    for (u = &global_ign, j--; *u && j; u = &((*u)->next), j--);
+    for (u = &global_ign, j--; *u && j; u = &((*u)->next), j--)
+      ;
     if (*u) {
       strlcpy(temp, (*u)->igmask, sizeof temp);
       i = 1;