Skip to content

Commit 1f855bb

Browse files
committed
nullptr c23
1 parent 1085779 commit 1f855bb

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.25...4.2)
1+
cmake_minimum_required(VERSION 3.25...4.4)
22
# 3.19 for CheckSourceCompiles
33
# 3.25 for block()
44

test/nullptr/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
set_property(DIRECTORY PROPERTY LABELS nullptr)
22

33
add_library(c_nullptr OBJECT lib.c)
4-
target_include_directories(c_nullptr PRIVATE .)
4+
target_include_directories(c_nullptr PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
5+
target_compile_features(c_nullptr PRIVATE c_std_23)
6+
57
add_library(cpp_nullptr OBJECT lib.cpp)
6-
target_include_directories(cpp_nullptr PRIVATE .)
8+
target_include_directories(cpp_nullptr PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
79

810
add_executable(C_Fortran_nullptr main.f90 $<TARGET_OBJECTS:c_nullptr>)
911
add_test(NAME C_Nullptr COMMAND C_Fortran_nullptr)

test/nullptr/lib.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
#include <nullptr.h>
21
#include <stddef.h>
32

3+
#if __STDC_VERSION__ < 202311L
4+
#include <stdbool.h>
5+
#endif
6+
47
const char* nullchar(bool b) {
5-
return b ? NULL : "hello";
8+
return b ? nullptr : "hello";
69
}

0 commit comments

Comments
 (0)