trilinos / Trilinos

Primary repository for the Trilinos Project
https://trilinos.org/
Other
1.19k stars 565 forks source link

Framework: Increasing warnings-as-errors in Trilinos #13311

Open achauphan opened 1 month ago

achauphan commented 1 month ago

Description

With the introduction of deprecated package header warnings in #12828, -Werror had to be turned off from several PR testing configurations (gcc-serial, gcc-openmpi, & gcc-openmpi-openmp). Since then, we cannot be confident that Trilinos can compile with minimal warnings related to all currently supported packages.

This discussion to increase more warnings-as-errors began in

How to inject package specific compiler flags with GenConfig

To reproduce errors caused by new warnings-as-errors flags for an isolated package using GenConfig, the package developer will need to add or modify an existing <package>_CXX_FLAGS variable within GenConfig's configurations files.

  1. Start from a fresh pull of develop branch.

  2. Modify [GCC_PACKAGE_SPECIFIC_WARNING_FLAGS] section of Trilinos/packages/framework/ini-files/config-specs.ini

    • If there already exists an entry in this section for you package, you can append onto string of flags like so:
      [GCC_PACKAGE_SPECIFIC_WARNING_FLAGS]
      opt-set-cmake-var <package>_CXX_FLAGS STRING : ${CMAKE_CXX_FLAGS|CMAKE} -Wno-error=shadow -Werror=<new-option-here>
    • If there does not currently exist an entry for you package, you can add a new entry by copying an existing entry, modifying the variable name with the appropriate package name, and appending the flags to the end as shown above.
  3. Configure with GenConfig There are three GCC PR test configurations that utilize [GCC_PACKAGE_SPECIFIC_WARNING_FLAGS]. Choose one of these to configurations in the table below and get GenConfig by running ./get_dependencies.sh --srn located in Trilinos/packages/framework on an SRN machine.

Source SEMS modules:

 source /projects/sems/modulefiles/utils/sems-modules-init.sh

Once you have GenConfig and the tool chain configuration you'd like to test on, run

source $TRILINOS_SRC/packages/framework/GenConfig/gen-config.sh --force <CONFIG_NAME> <TRILINOS_SRC>
Config shortname Full Config Name
GCC OpenMPI OpenMPI rhel8_sems-gnu-8.5.0-openmpi-4.1.6-serial_debug_shared_no-kokkos-arch_no-asan_no-complex_no-fpic_mpi_no-pt_no-rdc_no-uvm_deprecated-on_all
GCC OpenMP rhel8_sems-gnu-8.5.0-openmpi-4.1.6-openmp_release-debug_static_no-kokkos-arch_no-asan_no-complex_no-fpic_mpi_no-pt_no-rdc_no-uvm_deprecated-on_all
GCC rhel8_sems-gnu-8.5.0-serial_release-debug_shared_no-kokkos-arch_no-asan_no-complex_no-fpic_no-mpi_no-pt_no-rdc_no-uvm_deprecated-on_all
  1. Compile with ninja <package_name> to build your specific package.
achauphan commented 1 month ago

with @brian-kelley and @sebrowne's suggestions, starting with just adding -Werror=sign-compare -Werror=unused-variable in