Skip to content

Commit

Permalink
Adds some compile-time test and redundant defines to eliminate warnin…
Browse files Browse the repository at this point in the history
…gs in Eclipse with multiple build configurations
  • Loading branch information
myurkin committed Jun 16, 2024
1 parent e303191 commit 2051a46
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 17 deletions.
11 changes: 2 additions & 9 deletions src/debug.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* Functions for printing debugging information when compiling with option -DDEBUGFULL
/* Functions for printing debugging information when compiling with option -DDEBUGFULL.
* Should only be used with this macro, but IDE syntax checking works fine even without it.
*
* Copyright (C) ADDA contributors
* This file is part of ADDA.
Expand All @@ -12,14 +13,6 @@
* You should have received a copy of the GNU General Public License along with ADDA. If not, see
* <http://www.gnu.org/licenses/>.
*/

/* This file should be compiled only in full debug mode, hence the following declaration is redundant. However, it helps
* proper syntax checking in IDE, such as Eclipse.
*/
#ifndef DEBUGFULL
# define DEBUGFULL
#endif

#include "const.h" // keep this first
#include "debug.h" // corresponding header
// project headers
Expand Down
8 changes: 8 additions & 0 deletions src/fft.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
* You should have received a copy of the GNU General Public License along with ADDA. If not, see
* <http://www.gnu.org/licenses/>.
*/
/* The following tests for compilation inconsistencies, but also helps proper syntax checking in IDE, such as Eclipse.
* Otherwise, a lot of unresolved-symbol errors are produced, when another build configuration is selected.
*/
#ifdef SPARSE
# error "This file is incompatible with SPARSE"
# undef SPARSE
#endif

#include "const.h" // keep this first
#include "fft.h" // corresponding header
// project headers
Expand Down
4 changes: 2 additions & 2 deletions src/matvec.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* Calculate local matrix vector product of decomposed interaction matrix with r_k or p_k, using a FFT-based convolution
* algorithm. Also contains code for SPARSE (non-FFT) mode.
* Should not be used with OPENCL mode, but IDE syntax checking works fine even in this mode.
*
* Copyright (C) ADDA contributors
* This file is part of ADDA.
Expand Down Expand Up @@ -36,9 +37,8 @@ extern doublecomplex * restrict arg_full;
// defined and initialized in fft.c
extern const doublecomplex * restrict Dmatrix,* restrict Rmatrix;
extern doublecomplex * restrict Xmatrix,* restrict slices,* restrict slices_tr,* restrict slicesR,* restrict slicesR_tr;
extern const size_t DsizeY,DsizeZ;
extern const size_t DsizeY,DsizeZ,RsizeY;
#endif // !SPARSE
extern const size_t RsizeY;
// defined and initialized in timing.c
extern size_t TotalMatVec;

Expand Down
6 changes: 3 additions & 3 deletions src/oclcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
* You should have received a copy of the GNU General Public License along with ADDA. If not, see
* <http://www.gnu.org/licenses/>.
*/

/* This file should be compiled only in OpenCL mode, hence the following declaration is redundant. However, it helps
* proper syntax checking in IDE, such as Eclipse.
/* The following tests for compilation inconsistencies, but also helps proper syntax checking in IDE, such as Eclipse.
* Otherwise, a lot of unresolved-symbol errors are produced, when another build configuration is selected.
*/
#ifndef OPENCL
# error "This file requires OPENCL to be defined"
# define OPENCL
#endif

Expand Down
12 changes: 12 additions & 0 deletions src/oclmatvec.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@
* You should have received a copy of the GNU General Public License along with ADDA. If not, see
* <http://www.gnu.org/licenses/>.
*/
/* The following tests for compilation inconsistencies, but also helps proper syntax checking in IDE, such as Eclipse.
* Otherwise, a lot of unresolved-symbol errors are produced, when another build configuration is selected.
*/
#ifndef OPENCL
# error "This file requires OPENCL to be defined"
# define OPENCL
#endif
#ifdef SPARSE
# error "This file is incompatible with SPARSE"
# undef SPARSE
#endif

#include "const.h" // keep this first
// project headers
#include "comm.h"
Expand Down
6 changes: 3 additions & 3 deletions src/prec_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
* You should have received a copy of the GNU General Public License along with ADDA. If not, see
* <http://www.gnu.org/licenses/>.
*/

/* This file should be compiled only in precise timing mode, hence the following declaration is redundant. However, it
* helps proper syntax checking in IDE, such as Eclipse.
/* The following tests for compilation inconsistencies, but also helps proper syntax checking in IDE, such as Eclipse.
* Otherwise, a lot of unresolved-symbol errors are produced, when another build configuration is selected.
*/
#ifndef PRECISE_TIMING
# error "This file requires PRECISE_TIMING to be defined"
# define PRECISE_TIMING
#endif

Expand Down

0 comments on commit 2051a46

Please sign in to comment.