chiark / gitweb /
build-sys: use -Og instead of -O0 to catch warnings
authorKay Sievers <kay@vrfy.org>
Mon, 21 Oct 2013 13:24:18 +0000 (15:24 +0200)
committerKay Sievers <kay@vrfy.org>
Mon, 21 Oct 2013 13:46:00 +0000 (15:46 +0200)
  $ touch src/core/dbus.c; make CFLAGS=-O0
  make --no-print-directory all-recursive
  Making all in .
    CC       src/core/libsystemd_core_la-dbus.lo
    CCLD     libsystemd-core.la

  $ touch src/core/dbus.c; make CFLAGS=-Og
  make --no-print-directory all-recursive
  Making all in .
    CC       src/core/libsystemd_core_la-dbus.lo
  src/core/dbus.c: In function 'init_registered_system_bus':
  src/core/dbus.c:798:18: warning: 'id' may be used uninitialized in this function [-Wmaybe-uninitialized]
           dbus_free(id);
                    ^
    CCLD     libsystemd-core.la

-Og Optimize debugging experience. -Og enables optimizations that do
not interfere with debugging. It should be the optimization level of
choice for the standard edit-compile-debug cycle, offering a
reasonable level of optimization while maintaining fast compilation
and a good debugging experience.

autogen.sh
src/core/machine-id-setup.c
src/core/manager.c
src/shared/ask-password-api.c
src/tmpfiles/tmpfiles.c

index eeb0c1b5e3385356a22a8ca50a0424c55431500a..d0873422a995bd82adf2a115315740664916577d 100755 (executable)
@@ -54,7 +54,7 @@ args="$args \
 fi
 
 if [ "x$1" = "xc" ]; then
-        ./configure CFLAGS='-g -O0' $args
+        ./configure CFLAGS='-g -Og' $args
         make clean
 else
         echo
index 18e015fe7f09d73a8c96fe7f2e9b03217a1e1b6e..1b55da7e56b8b6117b3418d6414444b3bad7c4f0 100644 (file)
@@ -153,7 +153,7 @@ static int generate(char id[34]) {
 int machine_id_setup(void) {
         _cleanup_close_ int fd = -1;
         int r;
-        bool writable;
+        bool writable = false;
         struct stat st;
         char id[34]; /* 32 + \n + \0 */
 
index 01db2b0be9b640f0372c242ac239aab75b6c482f..60c22e31d7caa61807e71d562502aed2931690ad 100644 (file)
@@ -2062,7 +2062,7 @@ void manager_dispatch_bus_query_pid_done(
 
 int manager_open_serialization(Manager *m, FILE **_f) {
         char *path = NULL;
-        int fd;
+        int fd = -1;
         FILE *f;
 
         assert(_f);
index 4557155d45fc36a11afbbf2b75b373112372a7eb..755abf0b5e4c37279babfefe5aa4b6e1f2613946 100644 (file)
@@ -250,7 +250,8 @@ static int create_socket(char **name) {
         } sa = {
                 .un.sun_family = AF_UNIX,
         };
-        int one = 1, r;
+        int one = 1;
+        int r = 0;
         char *c;
 
         assert(name);
index e23847bbea65e1180598720c92ab30c178d41d8e..8051cb36ec6fd6fc0768e871b4aab0d6dca124a5 100644 (file)
@@ -465,8 +465,10 @@ static int item_set_perms(Item *i, const char *path) {
 }
 
 static int write_one_file(Item *i, const char *path) {
-        int r, e, fd, flags;
+        int e, flags;
+        int fd = -1;
         struct stat st;
+        int r = 0;
 
         flags = i->type == CREATE_FILE ? O_CREAT|O_APPEND :
                 i->type == TRUNCATE_FILE ? O_CREAT|O_TRUNC : 0;
@@ -638,8 +640,9 @@ static int glob_item(Item *i, int (*action)(Item *, const char *)) {
 }
 
 static int create_item(Item *i) {
-        int r, e;
+        int e;
         struct stat st;
+        int r = 0;
 
         assert(i);