Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ChangeLog.d/fix-module-import-in-extern-c-compiler-error.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Changes
* Fixes a compiler error when building C++ projects that use the 'modules'
C++ language feature, and consume Mbed TLS. The specific error is
module-import-in-extern-c, which occurs when an #include occurs within
'extern C' blocks.
8 changes: 4 additions & 4 deletions include/mbedtls/timing.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

#if !defined(MBEDTLS_TIMING_ALT)
// Regular implementation
//
Expand All @@ -43,6 +39,10 @@ typedef struct mbedtls_timing_delay_context {
#include "timing_alt.h"
#endif /* MBEDTLS_TIMING_ALT */

#ifdef __cplusplus
extern "C" {
#endif

/* Internal use */
unsigned long mbedtls_timing_get_timer(struct mbedtls_timing_hr_time *val, int reset);

Expand Down
1 change: 1 addition & 0 deletions programs/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ if(TEST_CPP)
)
add_executable(cpp_dummy_build "${cpp_dummy_build_cpp}")
set_base_compile_options(cpp_dummy_build)
target_compile_options(cpp_dummy_build PRIVATE -fmodules)
target_include_directories(cpp_dummy_build
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../include
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tf-psa-crypto/include
Expand Down