LCOV - code coverage report
Current view: top level - src/base - base_uses.f90 (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:dc5a454) Lines: 1 1 100.0 %
Date: 2025-06-17 07:40:17 Functions: 1 1 100.0 %

          Line data    Source code
       1             : ! Basic use statements and preprocessor macros
       2             : ! should be included in the use statements
       3             : 
       4           2 :   USE base_hooks,                      ONLY: cp__a,&
       5             :                                              cp__b,&
       6             :                                              cp__w,&
       7             :                                              cp__h,&
       8             :                                              cp__l,&
       9             :                                              cp_abort,&
      10             :                                              cp_warn,&
      11             :                                              cp_hint,&
      12             :                                              timeset,&
      13             :                                              timestop
      14             : 
      15             : #if defined(__OFFLOAD_CUDA) || defined(__OFFLOAD_HIP)
      16             : #define __OFFLOAD
      17             : #endif
      18             : 
      19             : ! Check for OpenMP early on - ideally before the compiler fails with a cryptic message.
      20             : #if !defined(_OPENMP)
      21             :    "OpenMP is required. Please add the corresponding flag (eg. -fopenmp for GFortran) to your Fortran compiler flags."
      22             : #endif
      23             : 
      24             : ! Dangerous: Full path can be arbitrarily long and might overflow Fortran line.
      25             : #if !defined(__SHORT_FILE__)
      26             : #define __SHORT_FILE__ __FILE__
      27             : #endif
      28             : 
      29             : #define __LOCATION__ cp__l(__SHORT_FILE__,__LINE__)
      30             : #define CPABORT(MSG) CALL cp__b(__SHORT_FILE__,__LINE__,MSG)
      31             : 
      32             : ! Issue a warning; warnings are summarized globally.
      33             : ! For conditional warnings see CPWARN_IF.
      34             : #define CPWARN(MSG) CALL cp__w(__SHORT_FILE__,__LINE__,MSG)
      35             : 
      36             : ! Like CPWARN but only if CONDition is true.
      37             : #define CPWARN_IF(COND, MSG) IF(COND)CPWARN(MSG)
      38             : 
      39             : ! In contrast to CPWARN, the warning counter is not increased
      40             : #define CPHINT(MSG) CALL cp__h(__SHORT_FILE__,__LINE__,MSG)
      41             : 
      42             : # define CPASSERT(COND) IF(.NOT.(COND))CALL cp__a(__SHORT_FILE__,__LINE__)
      43             : 
      44             : ! The MARK_USED macro can be used to mark an argument/variable as used. It is intended to make
      45             : ! it possible to switch on -Werror=unused-dummy-argument, but deal elegantly with, e.g.,
      46             : ! library wrapper routines that take arguments only used if the library is linked in.
      47             : ! This code should be valid for any Fortran variable, is always standard conforming,
      48             : ! and will be optimized away completely by the compiler
      49             : #define MARK_USED(FOO) IF(.FALSE.)THEN;DO;IF(SIZE(SHAPE(FOO))==-1) EXIT;ENDDO;ENDIF
      50             : 
      51             : ! Calculate version number from 2 or 3 components. Can be used for comparison, e.g.,
      52             : ! CPVERSION3(4, 9, 0) <= CPVERSION3(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
      53             : ! CPVERSION(8, 0) <= CPVERSION(__GNUC__, __GNUC_MINOR__)
      54             : #define CPVERSION2(MAJOR, MINOR) ((MAJOR) * 10000 + (MINOR) * 100)
      55             : #define CPVERSION3(MAJOR, MINOR, UPDATE) (CPVERSION2(MAJOR, MINOR) + (UPDATE))
      56             : #define CPVERSION CPVERSION2
      57             : 
      58             : ! On top of CPVERSION macro, test if MAJOR_TEST and MINOR_TEST are defined.
      59             : ! Usage:  #if CPVERSION_CHECK(9, 5, >, __GNUC__, __GNUC_MINOR__)
      60             : ! Perform actual comparison according to COMP argument.
      61             : ! Note: defined(MAJOR_TEST) and defined(MINOR_TEST) is avoided in macro
      62             : !       definition due to issues handling it in certain compilers.
      63             : #define CPVERSION_CHECK(MAJOR_BASE, MINOR_BASE, COMP, MAJOR_TEST, MINOR_TEST) ((MAJOR_TEST) && \
      64             :   (CPVERSION2(MAJOR_BASE, MINOR_BASE) COMP CPVERSION2(MAJOR_TEST, MINOR_TEST)))
      65             : 
      66             : ! Avoid to default initialize type-components (default c'tor)
      67             : #if CPVERSION_CHECK(9, 5, >, __GNUC__, __GNUC_MINOR__) || defined(__INTEL_COMPILER) || defined(__INTEL_LLVM_COMPILER)
      68             : #define FTN_NO_DEFAULT_INIT
      69             : #endif
      70             : 
      71             : ! gfortran before 8.3 complains about internal symbols not being specified in
      72             : ! any data clause when using DEFAULT(NONE) and OOP procedures are called from
      73             : ! within the parallel region.
      74             : #if CPVERSION_CHECK(8, 3, >, __GNUC__, __GNUC_MINOR__)
      75             : #define OMP_DEFAULT_NONE_WITH_OOP SHARED
      76             : #else
      77             : #define OMP_DEFAULT_NONE_WITH_OOP NONE
      78             : #endif

Generated by: LCOV version 1.15