Skip to content

Commit

Permalink
Set C standard to c11
Browse files Browse the repository at this point in the history
This is needed, because dlt_common.c includes `<QtGlobal>` which includes
implicitly `<qtypes.h>` which contains
```
static_assert(sizeof(ptrdiff_t) == sizeof(size_t), "Weird ptrdiff_t and size_t definitions");
...
```
But `static_assert` in C is available only from c11 standard.
Though this is working with clang, but not with gcc compiler, so we set
the standard explicitly to c11.
  • Loading branch information
omircon committed Nov 20, 2024
1 parent 085d3c0 commit cf30a0e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(CMAKE_C_STANDARD 11)

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif()
Expand Down
2 changes: 1 addition & 1 deletion src/src.pro
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ QT_VER_MIN = $$member(QT_VERSION, 1)

CONFIG += c++1z
*-gcc* {
QMAKE_CFLAGS += -std=gnu99
QMAKE_CFLAGS += -std=c11
QMAKE_CFLAGS += -Wall
QMAKE_CFLAGS += -Wextra
#QMAKE_CXXFLAGS += -pedantic
Expand Down

0 comments on commit cf30a0e

Please sign in to comment.