From 034979a3f12dd98f8f8df7a09446a2e28581bfe1 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Sat, 1 Jun 2024 17:07:52 -0500 Subject: [PATCH] Add command database extraction regex to all other c & c++ compile actions in toolsets. --- src/tools/como-linux.jam | 16 ++++++++++++++++ src/tools/como-win.jam | 16 ++++++++++++++++ src/tools/hp_cxx.jam | 12 +++++++++++- src/tools/intel-darwin.jam | 16 ++++++++++++++++ src/tools/intel-linux.jam | 20 ++++++++++++++++++++ src/tools/intel-vxworks.jam | 18 ++++++++++++++++++ src/tools/mipspro.jam | 16 ++++++++++++++++ src/tools/msvc.jam | 12 ++++++++++++ src/tools/pathscale.jam | 16 ++++++++++++++++ src/tools/pgi.jam | 16 ++++++++++++++++ src/tools/qcc.jam | 10 ++++++++++ src/tools/sun.jam | 16 ++++++++++++++++ src/tools/vmsdecc.jam | 8 ++++++++ 13 files changed, 191 insertions(+), 1 deletion(-) diff --git a/src/tools/como-linux.jam b/src/tools/como-linux.jam index 5bf54e734c..2f5174f9c6 100644 --- a/src/tools/como-linux.jam +++ b/src/tools/como-linux.jam @@ -85,11 +85,27 @@ actions link.dll bind LIBRARIES $(CONFIG_COMMAND) $(LINKFLAGS) -shared -o "$(<[1])" "$(>)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" "$(LIBRARIES)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) 2>&1 } +rule compile.c ( targets * : sources * : properties * ) +{ + local config_command = [ regex.escape + [ on $(targets[1]) return $(CONFIG_COMMAND) ] + : "()[]\\+.*^$\"" : "\\" ] ; + COMMAND_DATABASE on $(targets) = "($(config_command).*) 2\\>\\&1" ; +} + actions compile.c { $(CONFIG_COMMAND) -c --c99 --long_long -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o "$(<)" "$(>)" 2>&1 } +rule compile.c++ ( targets * : sources * : properties * ) +{ + local config_command = [ regex.escape + [ on $(targets[1]) return $(CONFIG_COMMAND) ] + : "()[]\\+.*^$\"" : "\\" ] ; + COMMAND_DATABASE on $(targets) = "($(config_command).*) 2\\>\\&1" ; +} + actions compile.c++ { $(CONFIG_COMMAND) -tused -c --long_long -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) $(C++FLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o "$(<)" "$(>)" 2>&1 diff --git a/src/tools/como-win.jam b/src/tools/como-win.jam index 3225ece1ab..d029207218 100644 --- a/src/tools/como-win.jam +++ b/src/tools/como-win.jam @@ -100,11 +100,27 @@ actions link bind LIBRARIES $(CONFIG_COMMAND) --no_version --no_prelink_verbose $(LINKFLAGS) -o "$(<[1]:S=)" @"@($(<[1]:W).rsp:E=$(nl)"$(>)")" "$(LIBRARIES)" "$(FINDLIBS:S=.lib)" } +rule compile.c ( targets * : sources * : properties * ) +{ + local config_command = [ regex.escape + [ on $(targets[1]) return $(CONFIG_COMMAND) ] + : "()[]\\+.*^$\"" : "\\" ] ; + COMMAND_DATABASE on $(targets) = "($(config_command)[^\n]*)" ; +} + actions compile.c { $(CONFIG_COMMAND) -c --c99 -e5 --no_version --display_error_number --diag_suppress=9,21,161,748,940,962 -U$(UNDEFS) -D$(DEFINES) $(WARN) $(CFLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -I"$(SYSHDRS)" -o "$(<:D=)" "$(>)" } +rule compile.c++ ( targets * : sources * : properties * ) +{ + local config_command = [ regex.escape + [ on $(targets[1]) return $(CONFIG_COMMAND) ] + : "()[]\\+.*^$\"" : "\\" ] ; + COMMAND_DATABASE on $(targets) = "($(config_command)[^\n]*)" ; +} + actions compile.c++ { $(CONFIG_COMMAND) -c -e5 --no_version --no_prelink_verbose --display_error_number --long_long --diag_suppress=9,21,161,748,940,962 --diag_error=461 -D__STL_LONG_LONG -U$(UNDEFS) -D$(DEFINES) $(WARN) $(CFLAGS) $(C++FLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -I"$(SYSHDRS)" -o "$(<)" "$(>)" diff --git a/src/tools/hp_cxx.jam b/src/tools/hp_cxx.jam index 5e664241ed..220cc1f1d4 100644 --- a/src/tools/hp_cxx.jam +++ b/src/tools/hp_cxx.jam @@ -182,6 +182,12 @@ actions link.dll bind LIBRARIES # Note: Relaxed ANSI mode (-std) is used for compilation because in strict ANSI # C89 mode (-std1) the compiler doesn't accept C++ comments in C files. As -std # is the default, no special flag is needed. + +rule compile.c ( targets * : sources * : properties * ) +{ + COMMAND_DATABASE on $(targets) = "(cc [^\n]*)" ; +} + actions compile.c { $(.root:E=)cc -c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o "$(<)" "$(>)" @@ -193,7 +199,7 @@ actions compile.c # Note: We deliberately don't suppress any warnings on the compiler command # line, the user can always do this in a customized toolset later on. -rule compile.c++ +rule compile.c++ ( targets * : sources * : properties * ) { # We preprocess the TEMPLATE_DEPTH command line option here because we found # no way to do it correctly in the actual action code. There we either get @@ -202,6 +208,10 @@ rule compile.c++ # "-pending_instantiations ". local template-depth = [ on $(1) return $(TEMPLATE_DEPTH) ] ; TEMPLATE_DEPTH on $(1) = "-pending_instantiations "$(template-depth) ; + local config_command = [ regex.escape + [ on $(targets[1]) return $(CONFIG_COMMAND) ] + : "()[]\\+.*^$\"" : "\\" ] ; + COMMAND_DATABASE on $(targets) = "($(config_command)[^\n]*)" ; } actions compile.c++ diff --git a/src/tools/intel-darwin.jam b/src/tools/intel-darwin.jam index b5e16da7c7..56ac80f3fb 100644 --- a/src/tools/intel-darwin.jam +++ b/src/tools/intel-darwin.jam @@ -159,11 +159,27 @@ flags intel-darwin.compile.c++ OPTIONS extra : -w3 ; flags intel-darwin.compile.c++ OPTIONS pedantic : -w3 -Wcheck ; flags intel-darwin.compile.c++ OPTIONS on : -Werror-all ; +rule compile.c ( targets * : sources * : properties * ) +{ + local config_command = [ regex.escape + [ on $(targets[1]) return $(CONFIG_COMMAND) ] + : "()[]\\+.*^$\"" : "\\" ] ; + COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ; +} + actions compile.c { "$(CONFIG_COMMAND)" -xc $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" } +rule compile.c++ ( targets * : sources * : properties * ) +{ + local config_command = [ regex.escape + [ on $(targets[1]) return $(CONFIG_COMMAND) ] + : "()[]\\+.*^$\"" : "\\" ] ; + COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ; +} + actions compile.c++ { "$(CONFIG_COMMAND)" -xc++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" diff --git a/src/tools/intel-linux.jam b/src/tools/intel-linux.jam index 3d3cdb54de..b34a82ccaa 100644 --- a/src/tools/intel-linux.jam +++ b/src/tools/intel-linux.jam @@ -243,8 +243,17 @@ rule init ( version ? : command * : options * ) _ = " " ; +rule set_command_db ( targets + ) +{ + local config_command = [ regex.escape + [ on $(targets[1]) return $(CONFIG_COMMAND) ] + : "()[]\\+.*^$\"" : "\\" ] ; + COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ; +} + rule compile.c++ ( targets * : sources * : properties * ) { + set_command_db $(targets) ; DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ; } @@ -255,6 +264,7 @@ actions compile.c++ bind PCH_FILE rule compile.c ( targets * : sources * : properties * ) { + set_command_db $(targets) ; DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ; } @@ -263,6 +273,16 @@ actions compile.c bind PCH_FILE LD_LIBRARY_PATH="$(RUN_PATH)" "$(CONFIG_COMMAND)" -c -xc $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -use-pch"$(PCH_FILE)" -c -o "$(<)" "$(>)" } +rule compile.c++.pch ( targets * : sources * : properties * ) +{ + set_command_db $(targets) ; +} + +rule compile.c.pch ( targets * : sources * : properties * ) +{ + set_command_db $(targets) ; +} + # # Compiling a pch first deletes any existing *.pchi file, as Intel's compiler # won't over-write an existing pch: instead it creates filename$1.pchi, filename$2.pchi diff --git a/src/tools/intel-vxworks.jam b/src/tools/intel-vxworks.jam index e0c27d66c3..eaa100947f 100644 --- a/src/tools/intel-vxworks.jam +++ b/src/tools/intel-vxworks.jam @@ -137,11 +137,29 @@ flags intel-vxworks.compile.c++ OPTIONS extra : -w3 ; flags intel-vxworks.compile.c++ OPTIONS pedantic : -w3 -Wcheck ; flags intel-vxworks.compile.c++ OPTIONS on : -Werror-all ; +rule set_command_db ( targets + ) +{ + local config_command = [ regex.escape + [ on $(targets[1]) return $(CONFIG_COMMAND) ] + : "()[]\\+.*^$\"" : "\\" ] ; + COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ; +} + +rule compile.c ( targets * : sources * : properties * ) +{ + set_command_db $(targets) ; +} + actions compile.c { "$(CONFIG_COMMAND)" -xc $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" } +rule compile.c++ ( targets * : sources * : properties * ) +{ + set_command_db $(targets) ; +} + actions compile.c++ { "$(CONFIG_COMMAND)" -xc++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" diff --git a/src/tools/mipspro.jam b/src/tools/mipspro.jam index afd3f6591b..4978b5808b 100644 --- a/src/tools/mipspro.jam +++ b/src/tools/mipspro.jam @@ -81,11 +81,27 @@ flags mipspro.compile INCLUDES ; flags mipspro.compile.fortran OPTIONS ; +rule compile.c ( targets * : sources * : properties * ) +{ + local config_command = [ regex.escape + [ on $(targets[1]) return $(CONFIG_C_COMMAND) ] + : "()[]\\+.*^$\"" : "\\" ] ; + COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ; +} + actions compile.c { "$(CONFIG_C_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" } +rule compile.c++ ( targets * : sources * : properties * ) +{ + local config_command = [ regex.escape + [ on $(targets[1]) return $(CONFIG_COMMAND) ] + : "()[]\\+.*^$\"" : "\\" ] ; + COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ; +} + actions compile.c++ { "$(CONFIG_COMMAND)" -FE:template_in_elf_section -ptused $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" diff --git a/src/tools/msvc.jam b/src/tools/msvc.jam index 33ed9f9b48..f170005d02 100644 --- a/src/tools/msvc.jam +++ b/src/tools/msvc.jam @@ -683,6 +683,12 @@ rule compile.c ( targets + : sources * : properties * ) set-setup-command $(targets) : $(properties) ; get-rspline $(targets) : -TC CFLAGS ; compile-c-c++ $(<) : $(>) ; + + local config_command = [ regex.escape [ on $(targets[1]) return $(.CC) ] + : "|()[]\\+.*^$\" " : "\\" ] ; + local cc_filter = [ regex.escape [ on $(targets[1]) return $(.CC.FILTER) ] + : "|()[]\\+.*^$\" " : "\\" ] ; + COMMAND_DATABASE on $(targets) = "($(config_command).*)$(cc_filter)" ; } @@ -751,6 +757,12 @@ rule compile-c-c++ ( targets + : sources * ) LOCATE on $(<[1]:S=.pdb) = [ on $(<[1]) return $(LOCATE) ] ; local pch-header = [ on $(<[1]) return $(PCH_HEADER) ] ; PCH_HEADER_AS_SPELLED on $(<[1]) = $(pch-header:G=) ; + + local config_command = [ regex.escape [ on $(targets[1]) return $(.CC) ] + : "|()[]\\+.*^$\" " : "\\" ] ; + local cc_filter = [ regex.escape [ on $(targets[1]) return $(.CC.FILTER) ] + : "|()[]\\+.*^$\" " : "\\" ] ; + COMMAND_DATABASE on $(targets) = "($(config_command).*)$(cc_filter)" ; } rule preprocess-c-c++ ( targets + : sources * ) diff --git a/src/tools/pathscale.jam b/src/tools/pathscale.jam index fc77768ea0..f722972131 100644 --- a/src/tools/pathscale.jam +++ b/src/tools/pathscale.jam @@ -100,6 +100,22 @@ flags pathscale.compile INCLUDES ; flags pathscale.compile.fortran USER_OPTIONS ; flags pathscale.compile.fortran90 USER_OPTIONS ; +rule compile.c ( targets * : sources * : properties * ) +{ + local config_command = [ regex.escape + [ on $(targets[1]) return $(CONFIG_C_COMMAND) ] + : "()[]\\+.*^$\"" : "\\" ] ; + COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ; +} + +rule compile.c++ ( targets * : sources * : properties * ) +{ + local config_command = [ regex.escape + [ on $(targets[1]) return $(CONFIG_COMMAND) ] + : "()[]\\+.*^$\"" : "\\" ] ; + COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ; +} + actions compile.c { "$(CONFIG_C_COMMAND)" $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" diff --git a/src/tools/pgi.jam b/src/tools/pgi.jam index c18062e521..c5734aa2d1 100644 --- a/src/tools/pgi.jam +++ b/src/tools/pgi.jam @@ -81,6 +81,22 @@ flags pgi.compile INCLUDES ; flags pgi.compile.fortran OPTIONS ; +rule compile.c ( targets * : sources * : properties * ) +{ + local config_command = [ regex.escape + [ on $(targets[1]) return $(CONFIG_C_COMMAND) ] + : "()[]\\+.*^$\"" : "\\" ] ; + COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ; +} + +rule compile.c++ ( targets * : sources * : properties * ) +{ + local config_command = [ regex.escape + [ on $(targets[1]) return $(CONFIG_COMMAND) ] + : "()[]\\+.*^$\"" : "\\" ] ; + COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ; +} + actions compile.c { "$(CONFIG_C_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" diff --git a/src/tools/qcc.jam b/src/tools/qcc.jam index 5d915b6574..972f83889c 100644 --- a/src/tools/qcc.jam +++ b/src/tools/qcc.jam @@ -140,6 +140,11 @@ rule compile.c++ } check-target-platform $(1) ; + + local config_command = [ regex.escape + [ on $(targets[1]) return $(CONFIG_COMMAND) ] + : "()[]\\+.*^$\"" : "\\" ] ; + COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ; } actions compile.c++ @@ -150,6 +155,11 @@ actions compile.c++ rule compile.c { check-target-platform $(1) ; + + local config_command = [ regex.escape + [ on $(targets[1]) return $(CONFIG_COMMAND) ] + : "()[]\\+.*^$\"" : "\\" ] ; + COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ; } actions compile.c diff --git a/src/tools/sun.jam b/src/tools/sun.jam index 50b74abfbf..1e248827e1 100644 --- a/src/tools/sun.jam +++ b/src/tools/sun.jam @@ -162,6 +162,22 @@ flags sun.compile.c++ OPTIONS ; flags sun.compile DEFINES ; flags sun.compile INCLUDES ; +rule compile.c ( targets * : sources * : properties * ) +{ + local config_command = [ regex.escape + [ on $(targets[1]) return $(CONFIG_C_COMMAND) ] + : "()[]\\+.*^$\"" : "\\" ] ; + COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ; +} + +rule compile.c++ ( targets * : sources * : properties * ) +{ + local config_command = [ regex.escape + [ on $(targets[1]) return $(CONFIG_COMMAND) ] + : "()[]\\+.*^$\"" : "\\" ] ; + COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ; +} + actions compile.c { "$(CONFIG_C_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" diff --git a/src/tools/vmsdecc.jam b/src/tools/vmsdecc.jam index 350e5a9603..9cac474f4c 100644 --- a/src/tools/vmsdecc.jam +++ b/src/tools/vmsdecc.jam @@ -170,6 +170,10 @@ rule compile.c++ ( targets * : sources * : properties * ) TARGET-CXX-REPO on $(targets) = [ on $(targets[1]) get-target-cxx-repo $(LOCATE) ] ; CXX-REPOS on $(targets) = [ on $(targets) return $(TARGET-CXX-REPO) $(CXX-REPOS) ] ; + + local config_command = [ regex.escape [ on $(targets[1]) return $(.CXX) ] + : "()[]\\+.*^$\"" : "\\" ] ; + COMMAND_DATABASE on $(targets) = "($(config_command)[^\n]*)" ; } @@ -178,6 +182,10 @@ rule compile.c ( targets * : sources * : properties * ) DEPENDS $(targets) : [ on $(targets) return $(SOURCE-INCLUDES) ] ; INCLUDES on $(targets) = [ on $(targets) get-includes $(sources) : $(INCLUDES) ] ; + + local config_command = [ regex.escape [ on $(targets[1]) return $(.CC) ] + : "()[]\\+.*^$\"" : "\\" ] ; + COMMAND_DATABASE on $(targets) = "($(config_command)[^\n]*)" ; } actions compile.c