Skip to content

Since C23 bool is keyword #1576

Open
@Roman3349

Description

@Roman3349

Describe the bug
Since C23 bool is keyword, so typedef unsigned int bool; causes compilation error. This is used in

typedef unsigned int bool;

To Reproduce

  1. Compile the library with GCC15

Expected behavior
Successful compilation.

Log files

[...]
[ 10%] Building C object src/CMakeFiles/common_ssl_obj_static.dir/Tree.c.o
cd /build/reproducible-path/paho.mqtt.c-1.3.14/obj-x86_64-linux-gnu/src && /usr/bin/cc -DOPENSSL=1 -DPAHO_MQTT_STATIC=1 -D_GNU_SOURCE  -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/paho.mqtt.c-1.3.14=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC   -fvisibility=hidden -MD -MT src/CMakeFiles/common_ssl_obj_static.dir/Tree.c.o -MF CMakeFiles/common_ssl_obj_static.dir/Tree.c.o.d -o CMakeFiles/common_ssl_obj_static.dir/Tree.c.o -c /build/reproducible-path/paho.mqtt.c-1.3.14/src/Tree.c
[ 10%] Building C object src/CMakeFiles/common_ssl_obj_static.dir/Socket.c.o
cd /build/reproducible-path/paho.mqtt.c-1.3.14/obj-x86_64-linux-gnu/src && /usr/bin/cc -DOPENSSL=1 -DPAHO_MQTT_STATIC=1 -D_GNU_SOURCE  -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/paho.mqtt.c-1.3.14=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC   -fvisibility=hidden -MD -MT src/CMakeFiles/common_ssl_obj_static.dir/Socket.c.o -MF CMakeFiles/common_ssl_obj_static.dir/Socket.c.o.d -o CMakeFiles/common_ssl_obj_static.dir/Socket.c.o -c /build/reproducible-path/paho.mqtt.c-1.3.14/src/Socket.c
In file included from /build/reproducible-path/paho.mqtt.c-1.3.14/src/MQTTProtocolClient.h:25,
                 from /build/reproducible-path/paho.mqtt.c-1.3.14/src/MQTTProtocolClient.c:35:
/build/reproducible-path/paho.mqtt.c-1.3.14/src/MQTTPacket.h:31:22: error: ‘bool’ cannot be defined via ‘typedef’
   31 | typedef unsigned int bool;
      |                      ^~~~
/build/reproducible-path/paho.mqtt.c-1.3.14/src/MQTTPacket.h:31:22: note: ‘bool’ is a keyword with ‘-std=c23’ onwards
/build/reproducible-path/paho.mqtt.c-1.3.14/src/MQTTPacket.h:31:1: warning: useless type name in empty declaration
   31 | typedef unsigned int bool;
      | ^~~~~~~
[ 11%] Building C object src/CMakeFiles/common_ssl_obj_static.dir/Log.c.o
cd /build/reproducible-path/paho.mqtt.c-1.3.14/obj-x86_64-linux-gnu/src && /usr/bin/cc -DOPENSSL=1 -DPAHO_MQTT_STATIC=1 -D_GNU_SOURCE  -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/paho.mqtt.c-1.3.14=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC   -fvisibility=hidden -MD -MT src/CMakeFiles/common_ssl_obj_static.dir/Log.c.o -MF CMakeFiles/common_ssl_obj_static.dir/Log.c.o.d -o CMakeFiles/common_ssl_obj_static.dir/Log.c.o -c /build/reproducible-path/paho.mqtt.c-1.3.14/src/Log.c
make[3]: *** [src/CMakeFiles/common_ssl_obj_static.dir/build.make:96: src/CMakeFiles/common_ssl_obj_static.dir/MQTTProtocolClient.c.o] Error 1
make[3]: *** Waiting for unfinished jobs....
[ 11%] Building C object src/CMakeFiles/common_ssl_obj.dir/Clients.c.o
cd /build/reproducible-path/paho.mqtt.c-1.3.14/obj-x86_64-linux-gnu/src && /usr/bin/cc -DOPENSSL=1 -DPAHO_MQTT_EXPORTS=1 -D_GNU_SOURCE  -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/paho.mqtt.c-1.3.14=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC   -fvisibility=hidden -MD -MT src/CMakeFiles/common_ssl_obj.dir/Clients.c.o -MF CMakeFiles/common_ssl_obj.dir/Clients.c.o.d -o CMakeFiles/common_ssl_obj.dir/Clients.c.o -c /build/reproducible-path/paho.mqtt.c-1.3.14/src/Clients.c
In file included from /build/reproducible-path/paho.mqtt.c-1.3.14/src/MQTTProtocolClient.h:25,
                 from /build/reproducible-path/paho.mqtt.c-1.3.14/src/MQTTProtocolClient.c:35:
/build/reproducible-path/paho.mqtt.c-1.3.14/src/MQTTPacket.h:31:22: error: ‘bool’ cannot be defined via ‘typedef’
   31 | typedef unsigned int bool;
      |                      ^~~~
/build/reproducible-path/paho.mqtt.c-1.3.14/src/MQTTPacket.h:31:22: note: ‘bool’ is a keyword with ‘-std=c23’ onwards
/build/reproducible-path/paho.mqtt.c-1.3.14/src/MQTTPacket.h:31:1: warning: useless type name in empty declaration
   31 | typedef unsigned int bool;
      | ^~~~~~~
In file included from /build/reproducible-path/paho.mqtt.c-1.3.14/src/MQTTPacket.c:28:
/build/reproducible-path/paho.mqtt.c-1.3.14/src/MQTTPacket.h:31:22: error: ‘bool’ cannot be defined via ‘typedef’
   31 | typedef unsigned int bool;
      |                      ^~~~
/build/reproducible-path/paho.mqtt.c-1.3.14/src/MQTTPacket.h:31:22: note: ‘bool’ is a keyword with ‘-std=c23’ onwards
/build/reproducible-path/paho.mqtt.c-1.3.14/src/MQTTPacket.h:31:1: warning: useless type name in empty declaration
   31 | typedef unsigned int bool;
      | ^~~~~~~
[ 12%] Building C object src/CMakeFiles/common_ssl_obj.dir/utf-8.c.o
cd /build/reproducible-path/paho.mqtt.c-1.3.14/obj-x86_64-linux-gnu/src && /usr/bin/cc -DOPENSSL=1 -DPAHO_MQTT_EXPORTS=1 -D_GNU_SOURCE  -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/paho.mqtt.c-1.3.14=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC   -fvisibility=hidden -MD -MT src/CMakeFiles/common_ssl_obj.dir/utf-8.c.o -MF CMakeFiles/common_ssl_obj.dir/utf-8.c.o.d -o CMakeFiles/common_ssl_obj.dir/utf-8.c.o -c /build/reproducible-path/paho.mqtt.c-1.3.14/src/utf-8.c
make[3]: *** [src/CMakeFiles/common_ssl_obj.dir/build.make:96: src/CMakeFiles/common_ssl_obj.dir/MQTTProtocolClient.c.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [src/CMakeFiles/common_ssl_obj_static.dir/build.make:138: src/CMakeFiles/common_ssl_obj_static.dir/MQTTPacket.c.o] Error 1
In file included from /build/reproducible-path/paho.mqtt.c-1.3.14/src/MQTTPacketOut.h:23,
                 from /build/reproducible-path/paho.mqtt.c-1.3.14/src/MQTTPacketOut.c:30:
/build/reproducible-path/paho.mqtt.c-1.3.14/src/MQTTPacket.h:31:22: error: ‘bool’ cannot be defined via ‘typedef’
   31 | typedef unsigned int bool;
      |                      ^~~~
/build/reproducible-path/paho.mqtt.c-1.3.14/src/MQTTPacket.h:31:22: note: ‘bool’ is a keyword with ‘-std=c23’ onwards
/build/reproducible-path/paho.mqtt.c-1.3.14/src/MQTTPacket.h:31:1: warning: useless type name in empty declaration
   31 | typedef unsigned int bool;
      | ^~~~~~~
make[3]: *** [src/CMakeFiles/common_ssl_obj_static.dir/build.make:152: src/CMakeFiles/common_ssl_obj_static.dir/MQTTPacketOut.c.o] Error 1
In file included from /build/reproducible-path/paho.mqtt.c-1.3.14/src/Log.c:27:
/build/reproducible-path/paho.mqtt.c-1.3.14/src/MQTTPacket.h:31:22: error: ‘bool’ cannot be defined via ‘typedef’
   31 | typedef unsigned int bool;
      |                      ^~~~
/build/reproducible-path/paho.mqtt.c-1.3.14/src/MQTTPacket.h:31:22: note: ‘bool’ is a keyword with ‘-std=c23’ onwards
/build/reproducible-path/paho.mqtt.c-1.3.14/src/MQTTPacket.h:31:1: warning: useless type name in empty declaration
   31 | typedef unsigned int bool;
      | ^~~~~~~
make[3]: *** [src/CMakeFiles/common_ssl_obj_static.dir/build.make:208: src/CMakeFiles/common_ssl_obj_static.dir/Log.c.o] Error 1
make[3]: Leaving directory '/build/reproducible-path/paho.mqtt.c-1.3.14/obj-x86_64-linux-gnu'
make[2]: *** [CMakeFiles/Makefile2:454: src/CMakeFiles/common_ssl_obj.dir/all] Error 2
make[3]: Leaving directory '/build/reproducible-path/paho.mqtt.c-1.3.14/obj-x86_64-linux-gnu'
make[2]: *** [CMakeFiles/Makefile2:550: src/CMakeFiles/common_ssl_obj_static.dir/all] Error 2
make[2]: Leaving directory '/build/reproducible-path/paho.mqtt.c-1.3.14/obj-x86_64-linux-gnu'
make[1]: *** [Makefile:159: all] Error 2
make[1]: Leaving directory '/build/reproducible-path/paho.mqtt.c-1.3.14/obj-x86_64-linux-gnu'
dh_auto_build: error: cd obj-x86_64-linux-gnu && make -j8 "INSTALL=install --strip-program=true" VERBOSE=1 returned exit code 2
make: *** [debian/rules:10: binary] Error 25

Environment (please complete the following information):

  • OS: Debian experimental
  • Version 1.3.14

Additional context
Debian package downstream bug report: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1097539

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions