Skip to content

Commit 83ccd9a

Browse files
committed
Moving to C23 and C++23
- Update toolchain and build config files. - Migrate code to use new versions and keywords.
1 parent c21b264 commit 83ccd9a

114 files changed

Lines changed: 699 additions & 780 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/copilot-instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ There is no standalone test suite or test runner in this repository. Testing is
103103

104104
### Language Standards
105105

106-
- **C++20** (`stdcpp20`) for C++ files (`.cpp`).
107-
- **C17** (`stdc17`) for C files (`.c`).
106+
- **C++23** (`stdcpp23`) for C++ files (`.cpp`).
107+
- **C23** (`stdc23`) for C files (`.c`).
108108
- HAL-level code tends to be C; CLR, PAL, and device API code is C++.
109109

110110
### Formatting

CMake/toolchain.arm-none-eabi.cmake

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,5 @@ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
5050
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
5151

5252
# set required C and C++ standard for ALL targets
53-
set(CMAKE_C_STANDARD 17 CACHE INTERNAL "C standard for all targets")
54-
set(CMAKE_CXX_STANDARD 17 CACHE INTERNAL "C++ standard for all targets")
55-
56-
# set all C and C++ extensions to be OFF on ALL targets
57-
# this forces the use of -std=c17 and -std=c++17 instead of -std=gnu17 and -std=gnu++17
58-
set(CMAKE_C_EXTENSIONS OFF CACHE INTERNAL "C compiler extensions OFF")
59-
set(CMAKE_CXX_EXTENSIONS OFF CACHE INTERNAL "C++ compiler extensions OFF")
53+
set(CMAKE_C_STANDARD 23 CACHE INTERNAL "C standard for all targets")
54+
set(CMAKE_CXX_STANDARD 23 CACHE INTERNAL "C++ standard for all targets")

nf.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
<ClCompile>
2626
<PreprocessorDefinitions>VIRTUAL_DEVICE;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;VERSION_MAJOR=$(NBGV_VersionMajor);VERSION_MINOR=$(NBGV_VersionMinor);VERSION_BUILD=$(NBGV_BuildNumber);VERSION_REVISION=$(TARGET_BUILD_COUNTER);PLATFORMNAMESTRING="WINDOWS";</PreprocessorDefinitions>
2727
<AdditionalIncludeDirectories>..\..\targets\win32\Include;..\..\targets\netcore\nanoFramework.nanoCLR;..\..\..\targets\netcore\nanoFramework.nanoCLR;..\..\..\..\targets\netcore\nanoFramework.nanoCLR;..\CLR\Include;..\..\CLR\Include;..\CorLib;..\HAL\Include;..\..\src\HAL\Include;..\..\..\src\HAL\Include;..\..\..\..\src\HAL\Include;..\PAL\Include;</AdditionalIncludeDirectories>
28-
<LanguageStandard>stdcpp20</LanguageStandard>
29-
<LanguageStandard_C>stdc17</LanguageStandard_C>
28+
<LanguageStandard>stdcpp23</LanguageStandard>
29+
<LanguageStandard_C>stdc23</LanguageStandard_C>
3030
</ClCompile>
3131
</ItemDefinitionGroup>
3232

src/CLR/Include/nanoCLR_Headers.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,4 @@
1616
#include <nanoWeak.h>
1717
#include <nanoPackStruct.h>
1818

19-
// Constants for configuration options
20-
21-
// Generic 'FALSE' preprocessor boolean constant
22-
#if !defined(FALSE)
23-
#define FALSE 0
24-
#endif
25-
26-
// Generic 'TRUE' preprocessor boolean constant
27-
#if !defined(TRUE)
28-
#define TRUE 1
29-
#endif
30-
3119
#endif // NANOCLR_HEADERS_H

src/DeviceInterfaces/Network/Enc28j60/enc28j60_lwip.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ bool enc28j60_lwip_setup_device(struct netif *pNetIF)
928928
ENC28J60_ECON1,
929929
(uint8_t)(1 << ENC28J60_ECON1_RXEN_BIT));
930930

931-
return TRUE;
931+
return true;
932932
}
933933

934934
void enc28j60_lwip_destroy_device()

src/DeviceInterfaces/System.Net/sys_net_native_System_Net_Security_CertificateManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ HRESULT Library_sys_net_native_System_Net_Security_CertificateManager::
5353
0,
5454
certificateSize,
5555
0,
56-
true) != TRUE)
56+
true) != true)
5757
{
5858
NANOCLR_SET_AND_LEAVE(CLR_E_FAIL);
5959
}
@@ -70,7 +70,7 @@ HRESULT Library_sys_net_native_System_Net_Security_CertificateManager::
7070
}
7171

7272
// reach here, we should be OK
73-
stack.SetResult_Boolean(TRUE);
73+
stack.SetResult_Boolean(true);
7474

7575
NANOCLR_CLEANUP();
7676

src/DeviceInterfaces/System.Net/sys_net_native_System_Net_Security_SslNative.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ HRESULT Library_sys_net_native_System_Net_Security_SslNative::ExitSecureContext_
223223

224224
CLR_INT32 sslContext = stack.Arg0().NumericByRef().s4;
225225

226-
int result = SSL_ExitContext(sslContext) == TRUE ? 0 : -1;
226+
int result = SSL_ExitContext(sslContext) == true ? 0 : -1;
227227

228228
stack.SetResult_I4(result);
229229

src/HAL/nanoHAL_SystemInformation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ bool GetHalSystemInfo(HalSystemInfo &systemInfo)
4444
(char *)&systemInfo.m_OemSerialNumbers.system_serial_number,
4545
sizeof(systemInfo.m_OemSerialNumbers.system_serial_number));
4646

47-
return TRUE;
47+
return true;
4848
#endif
4949
}
5050

@@ -62,7 +62,7 @@ bool Target_GetReleaseInfo(NFReleaseInfo &releaseInfo)
6262
hal_strlen_s(TARGETNAMESTRING),
6363
PLATFORMNAMESTRING,
6464
hal_strlen_s(PLATFORMNAMESTRING));
65-
return TRUE; // alternatively, return false if you didn't initialize the releaseInfo structure.
65+
return true; // alternatively, return false if you didn't initialize the releaseInfo structure.
6666
}
6767

6868
bool DebuggerIsConnected()

src/PAL/AsyncProcCall/AsyncCompletions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ void HAL_COMPLETION::Uninitialize()
242242

243243
GLOBAL_LOCK();
244244

245-
while (TRUE)
245+
while (true)
246246
{
247247
ptr = (HAL_COMPLETION *)g_HAL_Completion_List.ExtractFirstNode();
248248

src/PAL/AsyncProcCall/AsyncContinuations.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void HAL_CONTINUATION::Uninitialize()
9494

9595
HAL_CONTINUATION *ptr;
9696

97-
while (TRUE)
97+
while (true)
9898
{
9999
ptr = (HAL_CONTINUATION *)g_HAL_Continuation_List.ExtractFirstNode();
100100

0 commit comments

Comments
 (0)