diff options
author | Li Dongyang <dongyangli@ddn.com> | 2018-07-13 18:42:48 -0600 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2018-07-14 20:46:30 -0400 |
commit | fddc423dc6353552772969d70cec08e8378d8e57 (patch) | |
tree | 8086b02c564916b3c7c6174d093284d4bbbd9ef1 /debugfs | |
parent | e96393142ccd1da25ac1e2c9cebd7f20326f36c5 (diff) |
Fix compile error and warnings for old gcc versions
-Wimplicit-fallthrough option was added in gcc7 and
-Wpedantic was added in gcc4.8, while #pragma GCC diagnostic
support was not available until gcc4.6
We got following warnings:
../lib/ext2fs/fiemap.h:35: warning: expected [error|warning|ignored] after ‘#pragma GCC diagnostic’
../lib/ext2fs/fiemap.h:36: warning: unknown option after ‘#pragma GCC diagnostic’ kind
../lib/ext2fs/fiemap.h:38: warning: expected [error|warning|ignored] after ‘#pragma GCC diagnostic’
and error:
filefrag.c: In function ‘main’:
filefrag.c:577: error: #pragma GCC diagnostic not allowed inside functions
filefrag.c:578: error: #pragma GCC diagnostic not allowed inside functions
filefrag.c:595: error: #pragma GCC diagnostic not allowed inside functions
when compiling latest e2fsprogs with a gcc older than 4.6
e.g. on CentOS 6.9
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'debugfs')
-rw-r--r-- | debugfs/set_fields.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/debugfs/set_fields.c b/debugfs/set_fields.c index 65949060..e1e23a5d 100644 --- a/debugfs/set_fields.c +++ b/debugfs/set_fields.c @@ -75,8 +75,10 @@ static errcode_t parse_gd_csum(struct field_set_info *info, char *field, char *a static errcode_t parse_mmp_clear(struct field_set_info *info, char *field, char *arg); +#if __GNUC_PREREQ (4, 6) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#endif static struct field_set_info super_fields[] = { { "inodes_count", &set_sb.s_inodes_count, NULL, 4, parse_uint }, @@ -289,7 +291,9 @@ static struct field_set_info mmp_fields[] = { { "checksum", &set_mmp.mmp_checksum, NULL, 4, parse_uint }, { 0, 0, 0, 0 } }; +#if __GNUC_PREREQ (4, 6) #pragma GCC diagnostic pop +#endif #ifdef UNITTEST |