johnsonjh / johnsonjh/duma

CXX Standard

Open
#174 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
121
Forks
12
Avg merge
3h 13m
Merged PRs (30d)
1

Description

Without altering the C++ Standard in the CMake file, I kept running into errors like:
```
duma/src/dumapp.cpp:198:18: error: declaration of 'void* operator new(size_t, const std::nothrow_t&) throw ()' has a different exception specifier
void *DUMA_CDECL operator new(DUMA_SIZE_T size,
^~~~~~~~
In file included from local/duma/src/dumapp.cpp:38:
/duma/dumapp.h:94:18: note: from previous declaration 'void* operator new(size_t, const std::nothrow_t&)'
void *DUMA_CDECL operator new(DUMA_SIZE_T, const std::nothrow_t &) throw();
```

In addition, to build on QNX, I also had to tweak how threads were linked against:

```diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 18d9eec..f3b4499 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,8 +3,10 @@ project(DUMA C CXX)

# See README.md for help building and using DUMA

-set(CMAKE_CXX_STANDARD 98)
-set(CMAKE_CXX_STANDARD_REQUIRED off)
+find_package(Threads)
+
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)

if(POLICY CMP0063)
cmake_policy(SET CMP0063 NEW)
@@ -190,7 +192,7 @@ endif()
if (NOT DUMA_WITH_THREAD_SAFETY)
target_compile_definitions(DUMA_STATIC PRIVATE DUMA_NO_THREAD_SAFETY)
else()
- target_link_libraries(DUMA_STATIC PUBLIC pthread)
+ target_link_libraries(DUMA_STATIC PUBLIC $<$>:Threads::Threads>)
endif()
if (NOT DUMA_WITH_STRERROR)
target_compile_definitions(DUMA_STATIC PRIVATE DUMA_NO_STRERROR)
@@ -236,7 +238,7 @@ if (WIN32 AND MINGW)
message(STATUS "MINGW")
else()
message(STATUS "target link pthread to DUMA_SHARED")
- target_link_libraries( DUMA_SHARED PUBLIC pthread )
+ target_link_libraries( DUMA_SHARED PUBLIC $<$>:Threads::Threads> )
endif()
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with CMakeLists.txt and inspect the C++ standard and thread-linking configuration shown in the issue. Review the declarations in duma/src/dumapp.cpp and duma/dumapp.h, then check the QNX build path. Done means the project builds without the exception-specifier error and links its threaded targets correctly on QNX.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.