]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: haproxy: mark deinit_and_exit() as noreturn
authorWilly Tarreau <w@1wt.eu>
Mon, 15 Jun 2020 16:43:46 +0000 (18:43 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 15 Jun 2020 16:43:46 +0000 (18:43 +0200)
Commit 0a3b43d9c ("MINOR: haproxy: Make use of deinit_and_exit() for
clean exits") introduced this build warning:

  src/haproxy.c: In function 'main':
  src/haproxy.c:3775:1: warning: control reaches end of non-void function [-Wreturn-type]
   }
   ^

This is because the new deinit_and_exit() is not marked as "noreturn"
so depending on the optimizations, the noreturn attribute of exit() will
either leak through it and silence the warning or not and confuse the
compiler. Let's just add the attribute to fix this.

No backport is needed, this is purely 2.2.

include/haproxy/global.h
src/haproxy.c

index 1028c1b2a51809788427eb4dfdabef5d633e2e40..339214c4af67ee96660bc13e0746078b98cd6c91 100644 (file)
@@ -61,7 +61,7 @@ struct proxy;
 struct server;
 int main(int argc, char **argv);
 void deinit(void);
-void deinit_and_exit(int);
+__attribute__((noreturn)) void deinit_and_exit(int);
 void run_poll_loop(void);
 int tell_old_pids(int sig);
 int delete_oldpid(int pid);
index 245ac3b60822288d5e4d8ee7384a806e36f9d83f..6a8c13e6ddbdabd9f5e5abc0506515e5eced409a 100644 (file)
@@ -2866,7 +2866,7 @@ void deinit(void)
        deinit_pollers();
 } /* end deinit() */
 
-void deinit_and_exit(int status)
+__attribute__((noreturn)) void deinit_and_exit(int status)
 {
        deinit();
        exit(status);