stewartsmith / libeatmydata

libeatmydata - because fsync() should be a no-op
https://www.flamingspork.com/projects/libeatmydata/
GNU General Public License v3.0
409 stars 21 forks source link

Avoid redefining _GNU_SOURCE #30

Open thesamesam opened 1 year ago

thesamesam commented 1 year ago

It's harmless, but with 3dea342f64a73a271d24779474d1b304b8f5618c, we get:

x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I/var/tmp/portage/sys-fs/libeatmydata-131/work/libeatmydata-131     -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches -Wreturn-type      -ggdb3 -Werror=implicit-function-declaration -Werror=implicit-int -c -o libeatmydata/test/tst-cancel4.o /var/tmp/portage/sys-fs/libeatmydata-131/work/libeatmydata-131/libeatmydata/test/tst-cancel4.c
/var/tmp/portage/sys-fs/libeatmydata-131/work/libeatmydata-131/libeatmydata/test/tst-cancel4.c:28: warning: "_GNU_SOURCE" redefined
   28 | #define _GNU_SOURCE
      |
In file included from /var/tmp/portage/sys-fs/libeatmydata-131/work/libeatmydata-131/libeatmydata/test/tst-cancel4.c:26:
./config.h:115: note: this is the location of the previous definition
  115 | # define _GNU_SOURCE 1
      |

This is because we already have AC_USE_SYSTEM_EXTENSIONS in configure.ac which sets GNU_SOURCE in config.h for us.

We also explicitly add a config.h include to tst-invalidvd.c instead of relying on it via portability.h.