[40/62] bacula: Fix build with GCC 10

Message ID 20200816102953.3881-40-michael.tremer@ipfire.org
State Accepted
Commit e39437b25eed393b8a7fcae480cd2e1801f00efe
Headers
Series [01/62] bison: Update to 3.7.1 |

Commit Message

Michael Tremer Aug. 16, 2020, 10:29 a.m. UTC
  GCC 10 aborts compilation when nunbers are (potentially) out of range
when casted from one type to another:

fstype.c: In function 'bool fstype(FF_PKT*, char*, int)':
fstype.c:207:12: error: narrowing conversion of '4283649346' from
'unsigned int' to 'int' [-Wnarrowing]
  207 |       case 0xFF534D42:     fstype = "cifs"; break;          /*
CIFS_MAGIC_NUMBER */
      |            ^~~~~~~~~~
fstype.c:216:12: error: narrowing conversion of '4187351113' from
'unsigned int' to 'int' [-Wnarrowing]
  216 |       case 0xf995e849:     fstype = "hpfs"; break;          /*
HPFS_SUPER_MAGIC */
      |            ^~~~~~~~~~
fstype.c:217:12: error: narrowing conversion of '2508478710' from
'unsigned int' to 'int' [-Wnarrowing]
  217 |       case 0x958458f6:     fstype = "hugetlbfs"; break;     /*
HUGETLBFS_MAGIC */
      |            ^~~~~~~~~~
fstype.c:234:12: error: narrowing conversion of '2768370933' from
'unsigned int' to 'int' [-Wnarrowing]
  234 |       case 0xa501FCF5:     fstype = "vxfs"; break;
      |            ^~~~~~~~~~
fstype.c:237:12: error: narrowing conversion of '2435016766' from
'unsigned int' to 'int' [-Wnarrowing]
  237 |       case 0x9123683e:     fstype = "btrfs"; break;
      |            ^~~~~~~~~~

Does nobody build this for 32 bit any more?

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
---
 lfs/bacula | 3 +++
 1 file changed, 3 insertions(+)
  

Patch

diff --git a/lfs/bacula b/lfs/bacula
index f5220bf16..3201688f4 100644
--- a/lfs/bacula
+++ b/lfs/bacula
@@ -36,6 +36,9 @@  PAK_VER    = 6
 
 DEPS       =
 
+# For GCC 10
+CFLAGS    += -Wno-error=narrowing
+
 ###############################################################################
 # Top-level Rules
 ###############################################################################