Skip to content

Commit

Permalink
Extra warnings added and fixes to make them clear
Browse files Browse the repository at this point in the history
Credit to ChatGPT
  • Loading branch information
william-dawson committed Nov 15, 2023
1 parent c9d018c commit 58be504
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Source/C/TripletList_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ void AppendToTripletList_r_wrp(int *ih_this, const int *index_column,
void SetTripletAt_r_wrp(int *ih_this, const int *index, const int *index_column,
const int *index_row, const double *point_value);
void GetTripletAt_r_wrp(const int *ih_this, const int *index, int *index_column,
const int *index_row, double *point_value);
int *index_row, double *point_value);
void DestructTripletList_r_wrp(int *ih_this);
void SortTripletList_r_wrp(const int *ih_this, const int *matrix_size,
int *h_sorted);
Expand All @@ -24,7 +24,7 @@ void SetTripletAt_c_wrp(int *ih_this, const int *index, const int *index_column,
const int *index_row, const double *point_value_real,
const double *point_value_imag);
void GetTripletAt_c_wrp(const int *ih_this, const int *index, int *index_column,
const int *index_row, const double *point_value_real,
int *index_row, const double *point_value_real,
const double *point_value_imag);
void DestructTripletList_c_wrp(int *ih_this);
void SortTripletList_c_wrp(const int *ih_this, const int *matrix_size,
Expand Down
2 changes: 1 addition & 1 deletion Source/CPlusPlus/Logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void NTPoly::ActivateLogger(bool start_document) {

////////////////////////////////////////////////////////////////////////////////
void NTPoly::ActivateLogger(const string file_name, bool start_document) {
int string_length = file_name.length();
int string_length = static_cast<int>(file_name.length());
string temp = file_name;
ActivateLoggerFile_wrp(&start_document, &temp.c_str()[0], &string_length);
}
Expand Down
8 changes: 4 additions & 4 deletions Source/CPlusPlus/PSMatrix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Matrix_ps::Matrix_ps(int matrix_dimension, const ProcessGrid &grid) {

//////////////////////////////////////////////////////////////////////////////
Matrix_ps::Matrix_ps(std::string file_name, bool is_binary) {
int string_length = file_name.length();
int string_length = static_cast<int>(file_name.length());
if (is_binary) {
ConstructMatrixFromBinary_ps_wrp(ih_this, &file_name.c_str()[0],
&string_length);
Expand All @@ -40,7 +40,7 @@ Matrix_ps::Matrix_ps(std::string file_name, bool is_binary) {
//////////////////////////////////////////////////////////////////////////////
Matrix_ps::Matrix_ps(std::string file_name, const ProcessGrid &grid,
bool is_binary) {
int string_length = file_name.length();
int string_length = static_cast<int>(file_name.length());
if (is_binary) {
ConstructMatrixFromBinaryPG_ps_wrp(ih_this, &file_name.c_str()[0],
&string_length, grid.ih_this);
Expand All @@ -61,13 +61,13 @@ Matrix_ps::Matrix_ps(const Matrix_ps &matB) {

//////////////////////////////////////////////////////////////////////////////
void Matrix_ps::WriteToBinary(std::string file_name) const {
int string_length = file_name.length();
int string_length = static_cast<int>(file_name.length());
WriteMatrixToBinary_ps_wrp(ih_this, &file_name.c_str()[0], &string_length);
}

//////////////////////////////////////////////////////////////////////////////
void Matrix_ps::WriteToMatrixMarket(string file_name) const {
int string_length = file_name.length();
int string_length = static_cast<int>(file_name.length());
WriteMatrixToMatrixMarket_ps_wrp(ih_this, &file_name.c_str()[0],
&string_length);
}
Expand Down
4 changes: 2 additions & 2 deletions Source/CPlusPlus/Permutation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ extern "C" {
////////////////////////////////////////////////////////////////////////////////
namespace NTPoly {
////////////////////////////////////////////////////////////////////////////////
Permutation::Permutation(int matrix_dimension) {
Permutation::Permutation(int dimension) {
was_filled = false;
this->matrix_dimension = matrix_dimension;
this->matrix_dimension = dimension;
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
6 changes: 6 additions & 0 deletions Source/CPlusPlus/ProcessGrid.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#ifndef PROCESSGRID_h
#define PROCESSGRID_h

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
#pragma GCC diagnostic ignored "-Wuseless-cast"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#include <mpi.h>
#pragma GCC diagnostic pop

#include "Wrapper.h"

Expand Down
8 changes: 4 additions & 4 deletions Source/CPlusPlus/SMatrix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ Matrix_lsc::Matrix_lsc(int columns, int rows) {

////////////////////////////////////////////////////////////////////////////////
Matrix_lsr::Matrix_lsr(std::string file_name) {
int string_length = file_name.length();
int string_length = static_cast<int>(file_name.length());
ConstructMatrixFromFile_lsr_wrp(ih_this, &file_name.c_str()[0],
&string_length);
}
Matrix_lsc::Matrix_lsc(std::string file_name) {
int string_length = file_name.length();
int string_length = static_cast<int>(file_name.length());
ConstructMatrixFromFile_lsc_wrp(ih_this, &file_name.c_str()[0],
&string_length);
}
Expand Down Expand Up @@ -193,12 +193,12 @@ void Matrix_lsc::Print() const { PrintMatrix_lsc_wrp(ih_this); }

////////////////////////////////////////////////////////////////////////////////
void Matrix_lsr::WriteToMatrixMarket(string file_name) const {
int string_length = file_name.length();
int string_length = static_cast<int>(file_name.length());
PrintMatrixF_lsr_wrp(ih_this, &file_name.c_str()[0], &string_length);
}

void Matrix_lsc::WriteToMatrixMarket(string file_name) const {
int string_length = file_name.length();
int string_length = static_cast<int>(file_name.length());
PrintMatrixF_lsc_wrp(ih_this, &file_name.c_str()[0], &string_length);
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Fortran/PSMatrixModule.F90
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ RECURSIVE SUBROUTINE ConstructMatrixFromBinary_ps(this, file_name, &
END IF

!! Compute Offset
local_triplets = total_values / this%process_grid%total_processors
local_triplets = INT(total_values / this%process_grid%total_processors)
local_offset = INT(local_triplets, KIND=NTLONG) * &
& this%process_grid%global_rank
header_size = 3 * bytes_per_int + bytes_per_long
Expand Down
10 changes: 8 additions & 2 deletions Targets/Linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,11 @@ set(CXX_TOOLCHAINFLAGS_RELEASE "-O3 -fopenmp")
set(F_TOOLCHAINFLAGS_RELEASE "-O3 -cpp -fopenmp")

# Debug suggestions
set(CXX_TOOLCHAINFLAGS_DEBUG "-O0 -fopenmp -Wall")
set(F_TOOLCHAINFLAGS_DEBUG "-O0 -cpp -fcheck=all -Wall -std=f2003")
set(CXX_TOOLCHAINFLAGS_DEBUG "-O0 -fopenmp -Wall -Wextra \
-pedantic -pedantic-errors -Wshadow -Wnull-dereference \
-Wdouble-promotion -Woverloaded-virtual -Wmisleading-indentation \
-Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wuseless-cast \
-Wsign-conversion -Wconversion -Wcast-align -Wold-style-cast")
set(F_TOOLCHAINFLAGS_DEBUG "-O0 -cpp -fcheck=all -Wall -Wextra -Werror \
-pedantic -fimplicit-none -ffpe-trap=invalid,zero,overflow,underflow \
-std=f2003")

0 comments on commit 58be504

Please sign in to comment.