Skip to content

The code does not compile on ubuntu 20.04/gcc 9.4 after recent change in compilersupport_p.h #293

@mkm85

Description

@mkm85

Compiling on gcc9.4 gives the following error:
It can be reproduced by creating an ubuntu:20.04 container and compiling the software in that context.

/usr/bin/cc -DCBOR_NO_FLOATING_POINT -DCBOR_STATIC_DEFINE -I/sandbox/tinycbor/src -I/sandbox/tinycbor/build -std=c99 -Wall -Wextra -Werror=format-security -Werror=incompatible-pointer-types -Werror=implicit-function-declaration -Werror=int-conversion -MD -MT CMakeFiles/tinycbor.dir/src/cborparser.c.o -MF CMakeFiles/tinycbor.dir/src/cborparser.c.o.d -o CMakeFiles/tinycbor.dir/src/cborparser.c.o -c /sandbox/tinycbor/src/cborparser.c
In file included from /sandbox/tinycbor/src/cborinternal_p.h:35,
                 from /sandbox/tinycbor/src/cborparser.c:28:
/sandbox/tinycbor/src/cborparser.c: In function 'preparse_value':
/sandbox/tinycbor/src/compilersupport_p.h:57:41: error: expected expression before '[' token
   57 | #    define CBOR_FALLTHROUGH            [[fallthrough]]
      |                                         ^
/sandbox/tinycbor/src/cborparser.c:225:13: note: in expansion of macro 'CBOR_FALLTHROUGH'
  225 |             CBOR_FALLTHROUGH;
      |             ^~~~~~~~~~~~~~~~
/sandbox/tinycbor/src/compilersupport_p.h:57:43: error: 'fallthrough' undeclared (first use in this function)
   57 | #    define CBOR_FALLTHROUGH            [[fallthrough]]
      |                                           ^~~~~~~~~~~
/sandbox/tinycbor/src/cborparser.c:225:13: note: in expansion of macro 'CBOR_FALLTHROUGH'
  225 |             CBOR_FALLTHROUGH;
      |             ^~~~~~~~~~~~~~~~
/sandbox/tinycbor/src/compilersupport_p.h:57:43: note: each undeclared identifier is reported only once for each function it appears in
   57 | #    define CBOR_FALLTHROUGH            [[fallthrough]]
      |                                           ^~~~~~~~~~~
/sandbox/tinycbor/src/cborparser.c:225:13: note: in expansion of macro 'CBOR_FALLTHROUGH'
  225 |             CBOR_FALLTHROUGH;
      |             ^~~~~~~~~~~~~~~~
/sandbox/tinycbor/src/cborparser.c:224:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
  224 |             it->flags |= CborIteratorFlag_IntegerValueTooLarge;
      |             ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/sandbox/tinycbor/src/cborparser.c:226:9: note: here
  226 |         case TrueValue:
      |         ^~~~
make[2]: *** [CMakeFiles/tinycbor.dir/build.make:118: CMakeFiles/tinycbor.dir/src/cborparser.c.o] Error 1
make[2]: Leaving directory '/sandbox/tinycbor/build'
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/tinycbor.dir/all] Error 2
make[1]: Leaving directory '/sandbox/tinycbor/build'
make: *** [Makefile:136: all] Error 2
root@c72c7b9f59f6:/sandbox/tinycbor/build# /usr/bin/cc --version
cc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions