From 7a0c6ec78d70c9122d59b3dc2db231b156c929b3 Mon Sep 17 00:00:00 2001 From: Mathias Hasselmann Date: Wed, 16 Oct 2024 06:55:23 +0200 Subject: [PATCH 1/4] Clarify library intro in README (#180) --------- Co-authored-by: Jeremy Rifkin <51220084+jeremy-rifkin@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index da0bfbd..60a616c 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@
[![Try on Compiler Explorer](https://img.shields.io/badge/-Compiler%20Explorer-brightgreen?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAQCAYAAAAmlE46AAAACXBIWXMAAACwAAAAsAEUaqtpAAABSElEQVQokYVTsU7DMBB9QMTCEJbOMLB5oF0tRfUPIPIJZctYJkZYu3WMxNL+ARUfQKpImcPgDYnsXWBgYQl61TkYyxI3Wef37j3fnQ/6vkcsikY9AbiWq0mpbevDBmLRqDEAA4CEHMADgFRwrwDmch6X2i73RCFVHvC/WCeCMAFpC2AFoPPu5x4md4rnAN4luS61nYWSgauNU8ydkr0bLTMYAoIYtWqxM4LtEumeERDtfUjlMDrp7L67iddyyJtOvUIu2rquVn4iiVSOKXYhiMSJWLwUJZLuQ2CWmVldV4MT11UmXgB8fr0dX3WP6VHMiVrscim6Da2mJxffzwSU2v6xWzSKmzQ4cUTOaCBTvWgU14xkzjhckKm/q3wnrRAcAhksxMZNAdxEf0fRKI6E8zqT1C0X28ccRpqAUltW5pu4sxv5Mb8B4AciE3bHMxz/+gAAAABJRU5ErkJggg==&labelColor=2C3239&style=flat&label=Try+it+on&color=30C452)](https://godbolt.org/z/c6TqTzqcf) -Cpptrace is a simple, portable, and self-contained C++ stacktrace library supporting C++11 and greater on Linux, macOS, +Cpptrace is a simple and portable C++ stacktrace library supporting C++11 and greater on Linux, macOS, and Windows including MinGW and Cygwin environments. The goal: Make stack traces simple for once. Cpptrace also has a C API, docs [here](docs/c-api.md). From 557a4a6fab3c6e7b1341d48162039e1ca0b644e7 Mon Sep 17 00:00:00 2001 From: Reimu NotMoe <34613827+ReimuNotMoe@users.noreply.github.com> Date: Mon, 21 Oct 2024 12:52:29 +0800 Subject: [PATCH 2/4] Add missing #include in microfmt.hpp (#183) This fixes building latest cpptrace in macOS (https://github.com/jeremy-rifkin/microfmt/issues/1) --- src/utils/microfmt.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/microfmt.hpp b/src/utils/microfmt.hpp index 46876b2..2cf0b80 100644 --- a/src/utils/microfmt.hpp +++ b/src/utils/microfmt.hpp @@ -1,6 +1,7 @@ #ifndef MICROFMT_HPP #define MICROFMT_HPP +#include #include #include #include From 124dba5254bd4d396a2f48ab31aac5f6337000ac Mon Sep 17 00:00:00 2001 From: mhx Date: Mon, 21 Oct 2024 06:54:50 +0200 Subject: [PATCH 3/4] fix: actually use ccache binary returned by `find_program` (#184) The original code assumed that if `find_program` found `ccache`, then `ccache` must be in the `PATH`. However, `find_program` searches in a lot of different places. This can lead to situations where `ccache` is found, but the compile will fail because it's not in the path. This change also uses `CMAKE_XXX_COMPILER_LAUNCHER` instead of `RULE_LAUNCH_COMPILE`, as the latter is for internal use only per the CMake docs. --- CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 49a7787..d922ed7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,9 +24,10 @@ include(CheckCXXSourceCompiles) include(CheckCXXCompilerFlag) if(PROJECT_IS_TOP_LEVEL) - find_program(CCACHE_FOUND ccache) - if(CCACHE_FOUND) - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + find_program(CCACHE_PROGRAM ccache) + if(CCACHE_PROGRAM) + set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_PROGRAM}) + set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_PROGRAM}) endif() endif() From 9269a72c54e0faab981aa8710b65858e2eb1f59c Mon Sep 17 00:00:00 2001 From: Pavol Gono <28236775+gpalino@users.noreply.github.com> Date: Sun, 27 Oct 2024 16:30:36 +0100 Subject: [PATCH 4/4] Fixed compiler warnings and errors under MSYS2+MINGW64 platform. (#186) Fixed compiler warnings and errors under MSYS2+MINGW64 platform. --- src/binary/object.cpp | 5 ++++- src/binary/pe.cpp | 4 +++- src/demangle/demangle_with_winapi.cpp | 4 +++- src/from_current.cpp | 4 +++- src/platform/dbghelp_syminit_manager.cpp | 4 +++- src/platform/path.hpp | 4 +++- src/platform/program_name.hpp | 4 +++- src/symbols/symbols_with_dbghelp.cpp | 4 +++- src/unwind/unwind_with_winapi.cpp | 4 +++- src/utils/utils.cpp | 4 +++- 10 files changed, 31 insertions(+), 10 deletions(-) diff --git a/src/binary/object.cpp b/src/binary/object.cpp index 0920e42..7f4d524 100644 --- a/src/binary/object.cpp +++ b/src/binary/object.cpp @@ -5,6 +5,7 @@ #include "binary/module_base.hpp" #include +#include #include #include #include @@ -16,7 +17,9 @@ #include // needed for dladdr1's link_map info #endif #elif IS_WINDOWS - #define WIN32_LEAN_AND_MEAN + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif #include #endif diff --git a/src/binary/pe.cpp b/src/binary/pe.cpp index 107084a..dc0b728 100644 --- a/src/binary/pe.cpp +++ b/src/binary/pe.cpp @@ -10,7 +10,9 @@ #include #include -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN +#endif #include namespace cpptrace { diff --git a/src/demangle/demangle_with_winapi.cpp b/src/demangle/demangle_with_winapi.cpp index 6bfd576..5d702c4 100644 --- a/src/demangle/demangle_with_winapi.cpp +++ b/src/demangle/demangle_with_winapi.cpp @@ -4,7 +4,9 @@ #include -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN +#endif #include #include diff --git a/src/from_current.cpp b/src/from_current.cpp index d45c551..d099a76 100644 --- a/src/from_current.cpp +++ b/src/from_current.cpp @@ -11,7 +11,9 @@ #ifndef _MSC_VER #include #if IS_WINDOWS - #define WIN32_LEAN_AND_MEAN + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif #include #else #include diff --git a/src/platform/dbghelp_syminit_manager.cpp b/src/platform/dbghelp_syminit_manager.cpp index 774db78..e11f866 100644 --- a/src/platform/dbghelp_syminit_manager.cpp +++ b/src/platform/dbghelp_syminit_manager.cpp @@ -9,7 +9,9 @@ #include -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN +#endif #include #include diff --git a/src/platform/path.hpp b/src/platform/path.hpp index afb6775..849ad66 100644 --- a/src/platform/path.hpp +++ b/src/platform/path.hpp @@ -7,7 +7,9 @@ #include #if IS_WINDOWS -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN +#endif #include #endif diff --git a/src/platform/program_name.hpp b/src/platform/program_name.hpp index 7d22cda..e5dafac 100644 --- a/src/platform/program_name.hpp +++ b/src/platform/program_name.hpp @@ -7,7 +7,9 @@ #include "platform/platform.hpp" #if IS_WINDOWS -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN +#endif #include #define CPPTRACE_MAX_PATH MAX_PATH diff --git a/src/symbols/symbols_with_dbghelp.cpp b/src/symbols/symbols_with_dbghelp.cpp index 7bb05e2..0e665a9 100644 --- a/src/symbols/symbols_with_dbghelp.cpp +++ b/src/symbols/symbols_with_dbghelp.cpp @@ -12,7 +12,9 @@ #include #include -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN +#endif #include #include diff --git a/src/unwind/unwind_with_winapi.cpp b/src/unwind/unwind_with_winapi.cpp index 75ec5a1..2dd59b3 100644 --- a/src/unwind/unwind_with_winapi.cpp +++ b/src/unwind/unwind_with_winapi.cpp @@ -9,7 +9,9 @@ #include #include -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN +#endif #include // Fucking windows headers diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp index 80de344..4a2061e 100644 --- a/src/utils/utils.cpp +++ b/src/utils/utils.cpp @@ -2,7 +2,9 @@ #if IS_WINDOWS #include - #define WIN32_LEAN_AND_MEAN + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif #include #else #include