Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strict compiler warning policy for CI builds #1203

Merged
merged 6 commits into from
Feb 22, 2021
Merged

Conversation

pcarruscag
Copy link
Member

Proposed Changes

Regression tests will fail (code will not compile) on pedantic warnings, i.e. -Wall -Wextra -Wpedantic -Werror
For external libraries many warnings were manually disabled, because I don't know a better way of not having -Werror defined for them via meson.

PR Checklist

  • I am submitting my contribution to the develop branch.
  • My contribution generates no new compiler warnings (try with the '-Wall -Wextra -Wno-unused-parameter -Wno-empty-body' compiler flags, or simply --warnlevel=2 when using meson).
  • My contribution is commented and consistent with SU2 style.
  • I have added a test case that demonstrates my contribution, if necessary.
  • I have updated appropriate documentation (Tutorials, Docs Page, config_template.cpp) , if necessary.

Comment on lines 7 to 18
metis_default_warnings += ['-Wno-unused-result',
'-Wno-unused-parameter',
'-Wno-unused-variable',
'-Wno-unused-but-set-variable',
'-Wno-macro-redefined',
'-Wno-unknown-pragmas',
'-Wno-sign-compare',
'-Wno-clobbered',
'-Wno-empty-body',
'-Wno-unused-label',
'-Wno-misleading-indentation',
'-Wno-pedantic']
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe compiler warnings had not been invented when metis was written

@pcarruscag pcarruscag merged commit c863e9c into develop Feb 22, 2021
@pcarruscag pcarruscag deleted the strict_warning_policy branch February 22, 2021 23:07
Copy link
Contributor

@TobiKattmann TobiKattmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks pedro 💐
On top of the compiler warning changes for CI this PR contains a lot of pointers that became std::vector's, trailing whitespace cleanup and other things.


/*--- Sliding meshes variables. ---*/

su2double ****SlidingState = nullptr;
int **SlidingStateNodes = nullptr;
vector<su2matrix<su2double*> > SlidingState; // vector of matrix of pointers... inner dim alloc'd elsewhere (welcome, to the twilight zone)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:) Note to self: never deal with sliding states

@@ -2193,7 +2193,7 @@ class CFVMFlowSolverBase : public CSolver {
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the coefficient is evaluated.
* \return Value of the pressure coefficient.
*/
inline su2double* GetCharacPrimVar(unsigned short val_marker, unsigned long val_vertex) const final {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

y remove const 🐒 ? Changing to vector<su2activematrix> CharacPrimVar; would force you to also have a const return type, right? i.e.

inline const su2double* GetCharacPrimVar(unsigned short val_marker, unsigned long val_vertex) const final {

which makes things more complicated down the line

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, which is one of the benefits of having container types, you can actually enforce constness of member variables. With pointers you cannot do anything.

Comment on lines -40 to -42
Cvtrs.resize(nSpecies,0.0);
Cvves.resize(nSpecies,0.0);
eves.resize(nSpecies,0.0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somebody should set-up clang-tidy to format all merged PR's to get rid of those things ... I said somebody... not me :D

@@ -135,6 +134,8 @@ void CTecplotBinaryFileWriter::Write_Data(){

#ifdef HAVE_MPI

unsigned long nParallel_Line = dataSorter->GetnElem(LINE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok i don't use tecplot (so feel free to ignore) but I am curious what happened here? (Prob found because of the added compiler flags)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

me neither, that variable was not used for serial compilation, locally (gcc 7.5) it was not a warning but gcc 7.4 complained

su2double C, alpha_V, alpha_T;

su2double TMAC, TAC;
su2double Viscosity, Eddy_Visc, Lambda;
su2double Density, GasConstant;

su2double **Grad_PrimVar;
su2double Vector_Tangent_dT[3], Vector_Tangent_dTve[3], Vector_Tangent_HF[3];
const su2double* const* Grad_PrimVar;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okok
const pointer and const values ... but I wasn't aware that the * are split and one is with the second const which indicates a const pointer. (But I might be completely wrong here)
Did this get necesary with another change in this PR (which I missed), was it a warning?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could put even one more const... to say that you cannot change what is points to.
It is in my todo list to create a "matrix view" to be able to access the gradient without copying and without pointers... but I will never get there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is time in the Dev meeting tomorrow I might ask you again about this (both the code and your todo-list item) ... because i did not really get it :) 🐌

su2double** YPlus = nullptr; /*!< \brief Yplus for each boundary and vertex. */

bool space_centered; /*!< \brief True if space centered scheeme used. */
vector<su2double> CNearFieldOF_Inv; /*!< \brief Near field pressure (inviscid) for each boundary. */
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi!, I noticed that these codes from line 140 assign every boundary marker a container, even through these boundaries don't need these variable. I'm not sure if I'm understanding this correctly。

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If true, I think these codes are wasting memory, and I wonder is there any better way to store these variables?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants