Skip to content

Commit f44fb12

Browse files
RudolfWeeberclaude
andcommitted
core: define the always-inline attribute macro in one header only
BoxGeometry.hpp and aosoa_pack.hpp carried identical unguarded copies of ESPRESSO_ATTR_ALWAYS_INLINE; include utils/attributes.hpp instead so the definition cannot drift between copies. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 88469a8 commit f44fb12

3 files changed

Lines changed: 4 additions & 16 deletions

File tree

src/core/BoxGeometry.hpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "lees_edwards/LeesEdwardsBC.hpp"
2424

2525
#include <utils/Vector.hpp>
26+
#include <utils/attributes.hpp>
2627

2728
#include <bitset>
2829
#include <cassert>
@@ -31,12 +32,6 @@
3132
#include <stdexcept>
3233
#include <utility>
3334

34-
#if defined(__GNUG__) or defined(__clang__)
35-
#define ESPRESSO_ATTR_ALWAYS_INLINE [[gnu::always_inline]]
36-
#else
37-
#define ESPRESSO_ATTR_ALWAYS_INLINE
38-
#endif
39-
4035
namespace detail {
4136
/**
4237
* @brief Get the minimum-image distance between two coordinates.

src/core/aosoa_pack.hpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
#include "cell_system/CellStructure.hpp"
2525

26+
#include <utils/attributes.hpp>
27+
2628
#include <Kokkos_Core.hpp>
2729

2830
#include <omp.h>
@@ -31,12 +33,6 @@
3133
#include <cstdint>
3234
#include <span>
3335

34-
#if defined(__GNUG__) or defined(__clang__)
35-
#define ESPRESSO_ATTR_ALWAYS_INLINE [[gnu::always_inline]]
36-
#else
37-
#define ESPRESSO_ATTR_ALWAYS_INLINE
38-
#endif
39-
4036
struct CellStructure::AoSoA_pack {
4137
using PositionViewType =
4238
Kokkos::View<double *[3], Kokkos::LayoutRight, Kokkos::HostSpace>;

src/utils/include/utils/attributes.hpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@
2020
#pragma once
2121

2222
/** \file
23-
* Compiler-attribute macros shared across utils headers.
24-
*
25-
* Uses the same macro name and guard as the core attributes header, so
26-
* either header can be included first without redefinition.
23+
* Compiler-attribute macros shared across ESPResSo headers.
2724
*/
2825

2926
#ifndef ESPRESSO_ATTR_ALWAYS_INLINE

0 commit comments

Comments
 (0)