Skip to content

C23-incompatible bool definition and CMake build #1588

Closed

Description

@atsampson

What type of issue is this?

permanent - occurring repeatedly

What issue are you facing?

The build system used to explicitly set the C standard to C90 with set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu90") - this was removed in the #1586 changes. This causes build failure with a compiler like GCC 15 that defaults to C23, because several of the source files have non-C23-compatible definitions of bool.

There are two ways to fix this: either specify the C standard explicitly in CMake (it's simpler to do this by setting CMAKE_C_STANDARD), or fix the code to be compatible with newer versions of C (you could require C99 rather than C90 and use stdbool.h, for example).

What are the steps to reproduce this?

Build using CMake's defaults on a machine with GCC 15.

Can you provide any logs? (output, errors, etc.)

You get an error like this for each of the files that has a typedef for bool:

/src/radio/hackrf/work/ab605692553a9e59dd74222f98fa1dda86a5e44e/host/hackrf-tools/src/hackrf_operacake.c:31:13: error: ‘bool’ cannot be defined via ‘typedef’
   31 | typedef int bool;
      |             ^~~~
/src/radio/hackrf/work/ab605692553a9e59dd74222f98fa1dda86a5e44e/host/hackrf-tools/src/hackrf_operacake.c:31:13: note: ‘bool’ is a keyword with ‘-std=c23’ onwards
/src/radio/hackrf/work/ab605692553a9e59dd74222f98fa1dda86a5e44e/host/hackrf-tools/src/hackrf_operacake.c:31:1: warning: useless type name in empty declaration
   31 | typedef int bool;
      | ^~~~~~~

Activity

  1. mossmann commented on Oct 2, 2025

    @mossmann
    Member

    Thank you for the detailed report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions