Skip to content

Commit

Permalink
fix linker errors due to inline definitions (#1079)
Browse files Browse the repository at this point in the history
* Rely on "static inline" to also get a copy of the respective function into the library/archive (otherwise we see linker error for code that does not include the header with inline definitions). The "static inline" instead of just "static" avoids warnings about unused functions.
* Fixed copyright banner (make pretty). This change is unrelated to the PR.
  • Loading branch information
hfp committed Sep 3, 2020
1 parent 27ef449 commit cb12269
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/grid/common/grid_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ static const double fac[] = {
// \brief Minimum and maximum for integers (missing from the C standard)
// \author Ole Schuett
//******************************************************************************
inline int imin(int x, int y) { return (x < y ? x : y); }
inline int imax(int x, int y) { return (x > y ? x : y); }
static inline int imin(int x, int y) { return (x < y ? x : y); }
static inline int imax(int x, int y) { return (x > y ? x : y); }

//******************************************************************************
// \brief Equivalent of Fortran's MODULO, which always return a positive number.
// https://gcc.gnu.org/onlinedocs/gfortran/MODULO.html
// \author Ole Schuett
//******************************************************************************
inline int modulo(int a, int m) { return ((a % m + m) % m); }
static inline int modulo(int a, int m) { return ((a % m + m) % m); }

#endif // GRID_COMMON_H

Expand Down
4 changes: 3 additions & 1 deletion src/qs_chargemol.F
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
!--------------------------------------------------------------------------------------------------!
! CP2K: A general program to perform molecular dynamics simulations !
! Copyright (C) 2000 - 2020 CP2K developers group !
! Copyright 2000-2020 CP2K developers group <https://cp2k.org> !
! !
! SPDX-License-Identifier: GPL-2.0-or-later !
!--------------------------------------------------------------------------------------------------!

! **************************************************************************************************
Expand Down

0 comments on commit cb12269

Please sign in to comment.