From cb6d11d39ba93a381b39e3a6e474c70b5b6d0095 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Thu, 3 Apr 2025 11:21:45 +0200 Subject: [PATCH] CONFIG: add LIBO_LIBS support into wmake rules - provides an additional hook when linking OSspecific CONFIG: apply quiet flag to wmkdepend - suppresses "could not open FileName" warnings in quiet mode FIX: reinstate selection of strict/non-strict deprecation - accidentally removed in cf2b305b4f. - extend with a _STRICTER version as well. --- etc/bashrc | 1 + etc/cshrc | 1 + src/OpenFOAM/include/stdFoam.H | 15 ++++++++++++++- wmake/makefiles/general | 12 ++++++++++-- wmake/rules/General/general | 6 +++++- wmake/rules/General/transform | 4 ++++ wmake/wmake | 16 +++++----------- 7 files changed, 40 insertions(+), 15 deletions(-) diff --git a/etc/bashrc b/etc/bashrc index 8fefa32b063..60030f8ce9c 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -94,6 +94,7 @@ export WM_COMPILE_OPTION=Opt # +ccache : use ccache # +xcrun : use xcrun and native compilers [MacOS] # +strict : more deprecation warnings (may generate *many* warnings) +# ++strict : even more deprecation warnings # ccache=... : ccache command (unquoted, single/double or <> quoted) # version=... : compiler suffix (eg, version=11 -> gcc-11) # lnInclude-extra : add '-extra' option for wmakeLnInclude diff --git a/etc/cshrc b/etc/cshrc index fc8520fab81..b36054eabd4 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -94,6 +94,7 @@ setenv WM_COMPILE_OPTION Opt # +ccache : use ccache # +xcrun : use xcrun and native compilers [MacOS] # +strict : more deprecation warnings (may generate *many* warnings) +# ++strict : even more deprecation warnings # ccache=... : ccache command (unquoted, single/double or <> quoted) # version=... : compiler suffix (eg, version=11 -> gcc-11) # lnInclude-extra : add '-extra' option for wmakeLnInclude diff --git a/src/OpenFOAM/include/stdFoam.H b/src/OpenFOAM/include/stdFoam.H index a34e34e0948..24cf6c14b30 100644 --- a/src/OpenFOAM/include/stdFoam.H +++ b/src/OpenFOAM/include/stdFoam.H @@ -46,7 +46,20 @@ Description #define FOAM_DEPRECATED(since) [[deprecated("Since " #since)]] #define FOAM_DEPRECATED_FOR(since, replacement) [[deprecated("Since " #since "; use " #replacement)]] -#define FOAM_DEPRECATED_STRICT(since, replacement) [[deprecated("Since " #since "; use " #replacement)]] + +#ifdef FOAM_COMPILE_STRICT +# define FOAM_DEPRECATED_STRICT(since, replacement) [[deprecated("Since " #since "; use " #replacement)]] +# if (FOAM_COMPILE_STRICT > 1) +# define FOAM_DEPRECATED_STRICTER(since, replacement) [[deprecated("Since " #since "; use " #replacement)]] +# endif +#endif + +#ifndef FOAM_DEPRECATED_STRICT +#define FOAM_DEPRECATED_STRICT(since, replacement) +#endif +#ifndef FOAM_DEPRECATED_STRICTER +#define FOAM_DEPRECATED_STRICTER(since, replacement) +#endif // Branch prediction helpers. With C++20 can use [[likely]], [[unlikely]] #if defined(__GNUC__) || defined(__clang__) diff --git a/wmake/makefiles/general b/wmake/makefiles/general index cea6c586909..d2b9b4e9c14 100644 --- a/wmake/makefiles/general +++ b/wmake/makefiles/general @@ -6,7 +6,7 @@ # \\/ M anipulation | #------------------------------------------------------------------------------ # Copyright (C) 2011-2016 OpenFOAM Foundation -# Copyright (C) 2019-2023 OpenCFD Ltd. +# Copyright (C) 2019-2025 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -23,6 +23,13 @@ # WM_COMPILE_CONTROL (~openfoam) # WM_OSTYPE (windows) # +# User modification entries. Usually specified in Make/options +# +# EXE_INC : defines/includes etc for executable or library targets +# EXE_LIBS : linking for executables +# LIB_LIBS : linking for libraries (.so) +# LIBO_LIBS : linking for object libraries (.o) +# #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ @@ -74,6 +81,7 @@ endif EXE_INC = EXE_LIBS = LIB_LIBS = +LIBO_LIBS = # Project include/libraries PROJECT_INC = \ @@ -229,7 +237,7 @@ $(LIB).o: $(OBJECTS) @$(WM_SCRIPTS)/makeTargetDir $(LIB) @rm -f $(LIB).o $(call QUIET_MESSAGE,ld,$(LIB).o) - $E $(LD) -r -o $(LIB).o $(OBJECTS) + $E $(LD) -r -o $(LIB).o $(OBJECTS) $(LIBO_LIBS) #------------------------------------------------------------------------------ diff --git a/wmake/rules/General/general b/wmake/rules/General/general index dcfadee8ee0..028c83a78da 100644 --- a/wmake/rules/General/general +++ b/wmake/rules/General/general @@ -34,7 +34,11 @@ endif # Enable additional compile-time checks ifneq (,$(findstring +strict,$(WM_COMPILE_CONTROL))) - GFLAGS += -DFOAM_COMPILE_STRICT + ifneq (,$(findstring ++strict,$(WM_COMPILE_CONTROL))) + GFLAGS += -DFOAM_COMPILE_STRICT=2 + else + GFLAGS += -DFOAM_COMPILE_STRICT + endif endif # Default compilation is 'Opt' - never permit an empty value diff --git a/wmake/rules/General/transform b/wmake/rules/General/transform index 202d0a2a2b0..9e29954d6b3 100644 --- a/wmake/rules/General/transform +++ b/wmake/rules/General/transform @@ -11,6 +11,10 @@ WMKDEP := $(WMAKE_BIN)/wmkdepend WMKDEP_FLAGS := -eWM_PROJECT_DIR -eWM_THIRD_PARTY_DIR +ifneq (,$(strip $(WM_QUIET))) + WMKDEP_FLAGS += -q +endif + ifneq (,$(strip $(WM_QUIET))) E=@ define QUIET_MESSAGE diff --git a/wmake/wmake b/wmake/wmake index 86353e98b81..0f78d955d16 100755 --- a/wmake/wmake +++ b/wmake/wmake @@ -270,7 +270,8 @@ do ;; -strict) - opt_strict="+strict" + # Generate +strict (single use), ++strict (multiple use) + opt_strict="+${opt_strict:-strict}" ;; -build-root=*) @@ -529,16 +530,9 @@ esac # Handle -strict flag(s) if [ -n "$opt_strict" ] then - # Add +strict into WM_COMPILE_CONTROL - opt_strict="${WM_COMPILE_CONTROL:+ }+strict" - case "$WM_COMPILE_CONTROL" in - (*+strict*) - # Appears to have already been added - ;; - (*) - export WM_COMPILE_CONTROL="${WM_COMPILE_CONTROL}${opt_strict}" - ;; - esac + # Add +strict, ++strict, ... into WM_COMPILE_CONTROL + WM_COMPILE_CONTROL="${WM_COMPILE_CONTROL} ${opt_strict}" + export WM_COMPILE_CONTROL fi -- GitLab