Skip to content

Commit

Permalink
add github actions workflow & disable gcc9 warnings
Browse files Browse the repository at this point in the history
Additional: disable initializer list warning
  • Loading branch information
acki-m committed Aug 10, 2021
1 parent 8f75dd9 commit 7edbd58
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
23 changes: 23 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Linux

on: [push]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: seanmiddleditch/gha-setup-ninja@master

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_EXAMPLES=OFF -G Ninja

- name: Build
run: cmake --build ${{github.workspace}}/build

- name: Test
run: cmake --build ${{github.workspace}}/build --target run_tests
15 changes: 15 additions & 0 deletions src/rttr/detail/base/core_prerequisites.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,15 @@ namespace rttr
# define RTTR_END_DISABLE_OVERRIDE_WARNING
#endif

#if RTTR_COMP_VER >= 900
# define RTTR_BEGIN_DISABLE_INIT_LIST_WARNING _Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Winit-list-lifetime\"")
# define RTTR_END_DISABLE_INIT_LIST_WARNING _Pragma ("GCC diagnostic pop")
# else
# define RTTR_BEGIN_DISABLE_INIT_LIST_WARNING
# define RTTR_END_DISABLE_INIT_LIST_WARNING
#endif

# define RTTR_DECLARE_PLUGIN_CTOR __attribute__((constructor))
# define RTTR_DECLARE_PLUGIN_DTOR __attribute__((destructor))

Expand Down Expand Up @@ -313,6 +322,10 @@ namespace rttr
# define RTTR_END_DISABLE_OVERRIDE_WARNING
#endif


# define RTTR_BEGIN_DISABLE_INIT_LIST_WARNING
# define RTTR_END_DISABLE_INIT_LIST_WARNING

# define RTTR_DECLARE_PLUGIN_CTOR __attribute__((__constructor__))
# define RTTR_DECLARE_PLUGIN_DTOR __attribute__((__destructor__))

Expand All @@ -332,6 +345,8 @@ namespace rttr
# define RTTR_DECLARE_PLUGIN_DTOR
# define RTTR_BEGIN_DISABLE_OVERRIDE_WARNING
# define RTTR_END_DISABLE_OVERRIDE_WARNING
# define RTTR_BEGIN_DISABLE_INIT_LIST_WARNING
# define RTTR_END_DISABLE_INIT_LIST_WARNING

#else
# pragma message("WARNING: unknown compiler, don't know how to disable deprecated warnings")
Expand Down
3 changes: 2 additions & 1 deletion src/rttr/detail/variant/variant_data_policy.h
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ struct variant_data_policy_big : variant_data_base_policy<T, variant_data_policy
{
delete &value;
}

RTTR_BEGIN_DISABLE_INIT_LIST_WARNING
static RTTR_INLINE void clone(const T& value, variant_data& dest)
{
reinterpret_cast<T*&>(dest) = new T(value);
Expand All @@ -450,6 +450,7 @@ struct variant_data_policy_big : variant_data_base_policy<T, variant_data_policy
{
reinterpret_cast<T*&>(dest) = new T(std::forward<U>(value));
}
RTTR_END_DISABLE_INIT_LIST_WARNING
};

/////////////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 7edbd58

Please sign in to comment.