aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvpozdyayev <vpozdyayev@yandex-team.com>2024-03-22 09:26:02 +0300
committervpozdyayev <vpozdyayev@yandex-team.com>2024-03-22 09:38:01 +0300
commitdbcba9ca177b76f4bbe61abfbf7140824d59fe68 (patch)
tree8998d07c527f6c4650c6cd516fcdd1f912b8ac52
parentb1400c59dabcffb47e2024312d274aefbaabb45e (diff)
downloadydb-dbcba9ca177b76f4bbe61abfbf7140824d59fe68.tar.gz
Enable STRUCT_CMD for C/C++ compilation
b9f14071dcb806a1de47c935d61e40cd7901c8ce
-rw-r--r--build/conf/compilers/gnu_compiler.conf53
-rw-r--r--build/conf/compilers/msvc_compiler.conf8
-rw-r--r--build/ymake.core.conf40
3 files changed, 94 insertions, 7 deletions
diff --git a/build/conf/compilers/gnu_compiler.conf b/build/conf/compilers/gnu_compiler.conf
index 66e0711df7..a76d99a9fe 100644
--- a/build/conf/compilers/gnu_compiler.conf
+++ b/build/conf/compilers/gnu_compiler.conf
@@ -185,6 +185,10 @@ when (($TIME_TRACE == "yes" || $COMPILER_TIME_TRACE == "yes") && $_HAS_TIME_TRAC
}
_C_CPP_KV_STYLE=${hide;kv:"p CC"} ${hide;kv:"pc green"}
+_C_CPP_KV_STYLE_NEW=${hide;kv:_C_CPP_KV_STYLE_P} ${hide;kv:_C_CPP_KV_STYLE_PC}
+_C_CPP_KV_STYLE_P=p CC
+_C_CPP_KV_STYLE_PC=pc green
+
_CPP_ARGS=\
$CLANG_STATIC_ANALYZER_OPTIONS && \
$CLANG_TIDY_ARGS \
@@ -206,6 +210,32 @@ _CPP_ARGS=\
&& $_COMPILER_TIME_TRACE_POSTPROCESS \
$_C_CPP_KV_STYLE
+_CPP_ARGS_NEW_CMD_0=\
+ $CLANG_STATIC_ANALYZER_OPTIONS_NEW
+
+_CPP_ARGS_NEW_CMD_1_1=\
+ $CLANG_TIDY_ARGS \
+ $YNDEXER_ARGS \
+ $RETRY_ARGS \
+ $CXX_COMPILER \
+ $C_FLAGS_PLATFORM \
+ $GCC_COMPILE_FLAGS \
+ $CXXFLAGS \
+ $CL_MACRO_INFO \
+ $CL_MACRO_INFO_DISABLE_CACHE__NO_UID__ \
+ $_COMPILER_TIME_TRACE_FLAGS \
+ $EXTRA_OUTPUT
+_CPP_ARGS_NEW_CMD_1_2=\
+ $SRCFLAGS \
+ $_LANG_CFLAGS_VALUE_NEW \
+ ${input:SRC} \
+ $TOOLCHAIN_ENV \
+ $YNDEXER_OUTPUT
+_CPP_ARGS_NEW_CMD_2=\
+ $_COMPILER_TIME_TRACE_POSTPROCESS \
+ $_C_CPP_KV_STYLE_NEW \
+ $SCU_NAME_KV_NEW
+
_C_ARGS=\
$CLANG_TIDY_ARGS \
$YNDEXER_ARGS \
@@ -225,6 +255,26 @@ _C_ARGS=\
$YNDEXER_OUTPUT \
$_C_CPP_KV_STYLE
+_C_ARGS_NEW=\
+ $CLANG_TIDY_ARGS \
+ $YNDEXER_ARGS \
+ $RETRY_ARGS \
+ $C_COMPILER \
+ $C_FLAGS_PLATFORM \
+ $GCC_COMPILE_FLAGS \
+ $CFLAGS \
+ $CL_MACRO_INFO \
+ $CL_MACRO_INFO_DISABLE_CACHE__NO_UID__ \
+ $_COMPILER_TIME_TRACE_FLAGS \
+ $CONLYFLAGS \
+ $EXTRA_OUTPUT \
+ $SRCFLAGS \
+ ${input:SRC} \
+ $TOOLCHAIN_ENV \
+ $YNDEXER_OUTPUT \
+ $_C_CPP_KV_STYLE_NEW \
+ $SCU_NAME_KV_NEW
+
### _SRC_C_NODEPS_CMD is obtained from _C_ARGS by filtering the following elements:
### ${input:SRC}
### $CL_MACRO_INFO
@@ -249,6 +299,9 @@ _SRC_C_NODEPS_CMD=\
_FORCE_CPP_FLAGS=-x c++
_SRC_CPP_CMD=$_CPP_ARGS
+_SRC_CPP_CMD_NEW= $_CPP_ARGS_NEW_CMD_0 && $_CPP_ARGS_NEW_CMD_1_1 $_CPP_ARGS_NEW_CMD_1_2 && $_CPP_ARGS_NEW_CMD_2
+_SRC_CPP_CMD_NEW_FORCED=$_CPP_ARGS_NEW_CMD_0 $CLANG_STATIC_ANALYZER_OPTIONS_NEW_FORCED && $_CPP_ARGS_NEW_CMD_1_1 $_FORCE_CPP_FLAGS $_CPP_ARGS_NEW_CMD_1_2 && $_CPP_ARGS_NEW_CMD_2
_SRC_C_CMD=$_C_ARGS
+_SRC_C_CMD_NEW=$_C_ARGS_NEW
_SRC_M_CMD=$SRC_c($SRC $SRCFLAGS)
_SRC_MASM_CMD=$_EMPTY_CMD
diff --git a/build/conf/compilers/msvc_compiler.conf b/build/conf/compilers/msvc_compiler.conf
index 7eacd84c91..8e62e741bb 100644
--- a/build/conf/compilers/msvc_compiler.conf
+++ b/build/conf/compilers/msvc_compiler.conf
@@ -92,8 +92,14 @@ when ($_UNDER_WINE_TOOLS == "yes") {
_FORCE_CPP_FLAGS=/TP
+_C_CPP_KV_STYLE_P=p CC
+_C_CPP_KV_STYLE_PC=pc yellow
+
_SRC_C_NODEPS_CMD=${TOOLCHAIN_ENV} ${CL_WRAPPER} ${C_COMPILER} /c /Fo${OUTFILE} ${SRC} ${EXTRA_C_FLAGS} ${pre=/I :INC} ${CFLAGS} ${hide;kv:"soe"} ${hide;kv:"p CC"} ${hide;kv:"pc yellow"}
_SRC_CPP_CMD=${TOOLCHAIN_ENV} ${CL_WRAPPER} ${CXX_COMPILER} /c /Fo$_COMPILE_OUTPUTS ${input;msvs_source:SRC} ${EXTRA_C_FLAGS} ${pre=/I :_C__INCLUDE} ${CXXFLAGS} ${SRCFLAGS} ${_LANG_CFLAGS_VALUE} ${hide;kv:"soe"} ${hide;kv:"p CC"} ${hide;kv:"pc yellow"}
-_SRC_C_CMD=${TOOLCHAIN_ENV} ${CL_WRAPPER} ${C_COMPILER} /c /Fo$_COMPILE_OUTPUTS ${input;msvs_source:SRC} ${EXTRA_C_FLAGS} ${pre=/I :_C__INCLUDE} ${CFLAGS} ${CONLYFLAGS} ${SRCFLAGS} ${hide;kv:"soe"} ${hide;kv:"p CC"} ${hide;kv:"pc yellow"}
+_SRC_CPP_CMD_NEW=${TOOLCHAIN_ENV} ${CL_WRAPPER} ${CXX_COMPILER} /c /Fo$_COMPILE_OUTPUTS ${msvs_source;input:SRC} ${EXTRA_C_FLAGS} ${pre=/I :_C__INCLUDE} ${CXXFLAGS} ${SRCFLAGS} ${_LANG_CFLAGS_VALUE_NEW} ${hide;kv:"soe"} ${hide;kv:_C_CPP_KV_STYLE_P} ${hide;kv:_C_CPP_KV_STYLE_PC}
+_SRC_CPP_CMD_NEW_FORCED=${TOOLCHAIN_ENV} ${CL_WRAPPER} ${CXX_COMPILER} /c /Fo$_COMPILE_OUTPUTS ${msvs_source;input:SRC} ${EXTRA_C_FLAGS} ${pre=/I :_C__INCLUDE} ${CXXFLAGS} $_FORCE_CPP_FLAGS ${SRCFLAGS} ${_LANG_CFLAGS_VALUE_NEW} ${hide;kv:"soe"} ${hide;kv:_C_CPP_KV_STYLE_P} ${hide;kv:_C_CPP_KV_STYLE_PC}
+_SRC_C_CMD=${TOOLCHAIN_ENV} ${CL_WRAPPER} ${C_COMPILER} /c /Fo$_COMPILE_OUTPUTS ${msvs_source;input:SRC} ${EXTRA_C_FLAGS} ${pre=/I :_C__INCLUDE} ${CFLAGS} ${CONLYFLAGS} ${SRCFLAGS} ${hide;kv:"soe"} ${hide;kv:"p CC"} ${hide;kv:"pc yellow"}
+_SRC_C_CMD_NEW=${TOOLCHAIN_ENV} ${CL_WRAPPER} ${C_COMPILER} /c /Fo$_COMPILE_OUTPUTS ${msvs_source;input:SRC} ${EXTRA_C_FLAGS} ${pre=/I :_C__INCLUDE} ${CFLAGS} ${CONLYFLAGS} ${SRCFLAGS} ${hide;kv:"soe"} ${hide;kv:_C_CPP_KV_STYLE_P} ${hide;kv:_C_CPP_KV_STYLE_PC}
_SRC_M_CMD=$_EMPTY_CMD
_SRC_MASM_CMD=${cwd:ARCADIA_BUILD_ROOT} ${TOOLCHAIN_ENV} ${ML_WRAPPER} ${MASM_COMPILER} ${MASMFLAGS} ${SRCFLAGS} $_MASM_IO ${kv;hide:"p AS"} ${kv;hide:"pc yellow"}
diff --git a/build/ymake.core.conf b/build/ymake.core.conf
index 38a661010c..5675e5bc81 100644
--- a/build/ymake.core.conf
+++ b/build/ymake.core.conf
@@ -22,6 +22,8 @@ FBS_FAKEID=2024-03-13
# but will not affect builds anyhow (except tests referring build/ directory)
JSON_CACHE_FAKE_ID=11215402
+STRUCT_CMD=yes
+
CURDIR=.
MODDIR=.
BINDIR=bin:/
@@ -170,9 +172,19 @@ when ($CLANG_SA_ENABLE == "yes" && $_CLANG_SA_CONFIG && $CLANG_CSA_ROOT) {
"--config-file" ${input:_CLANG_SA_CONFIG} \
"--plugins-begin" "dummy_param" $_CLANG_SA_UNWRAP_PLUGINS($CLANG_SA_PLUGINS) "--plugins-end" \
$GCC_COMPILE_FLAGS $CXXFLAGS $SRCFLAGS
+ CLANG_STATIC_ANALYZER_OPTIONS_NEW=$YMAKE_PYTHON3 ${input:"build/scripts/clang_static_analyzer.py"} \
+ "--testing-src" ${input:SRC} \
+ "--clang-bin" $CLANG_CSA_BIN \
+ "--source-root" $(SOURCE_ROOT) \
+ "--config-file" ${input:_CLANG_SA_CONFIG} \
+ "--plugins-begin" "dummy_param" $CLANG_SA_PLUGINS "--plugins-end" \
+ $GCC_COMPILE_FLAGS $CXXFLAGS $SRCFLAGS
+ CLANG_STATIC_ANALYZER_OPTIONS_NEW_FORCED=$_FORCE_CPP_FLAGS
}
otherwise {
CLANG_STATIC_ANALYZER_OPTIONS=
+ CLANG_STATIC_ANALYZER_OPTIONS_NEW=
+ CLANG_STATIC_ANALYZER_OPTIONS_NEW_FORCED=
}
FAIL_MODULE_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/fail_module_cmd.py"} $TARGET ${kv;hide:"p ER"} ${kv;hide:"pc red"}
@@ -3122,36 +3134,42 @@ macro _SRC("f", SRC, SRCFLAGS...) {
# tag:src-processing
macro _SRC("cpp", SRC, SRCFLAGS...) {
- .CMD=$_SRC_cpp($SRC $SRCFLAGS)
+ .CMD=$_SRC_CPP_CMD_NEW
.SEM=target_sources PRIVATE ${input:SRC} ${hide;output;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
+ .STRUCT_CMD=yes
}
# tag:src-processing
macro _SRC("cxx", SRC, SRCFLAGS...) {
- .CMD=$_SRC(cpp $SRC $SRCFLAGS)
+ .CMD=$_SRC_CPP_CMD_NEW
+ .STRUCT_CMD=yes
}
# tag:src-processing
macro _SRC("cc", SRC, SRCFLAGS...) {
- .CMD=$_SRC(cpp $SRC $SRCFLAGS)
+ .CMD=$_SRC_CPP_CMD_NEW
.SEM=target_sources PRIVATE ${input:SRC} ${hide;output;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
+ .STRUCT_CMD=yes
}
# tag:src-processing
macro _SRC("auxcpp", SRC, SRCFLAGS...) {
- .CMD=$_SRC_cpp($SRC $_FORCE_CPP_FLAGS $SRCFLAGS)
+ .CMD=$_SRC_CPP_CMD_NEW_FORCED
.SEM=target_sources PRIVATE ${input:SRC} ${hide;output;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($_FORCE_CPP_FLAGS $SRCFLAGS)
+ .STRUCT_CMD=yes
}
# tag:src-processing
macro _SRC("C", SRC, SRCFLAGS...) {
- .CMD=$_SRC(cpp $SRC $SRCFLAGS)
+ .CMD=$_SRC_CPP_CMD_NEW
+ .STRUCT_CMD=yes
}
# tag:src-processing
macro _SRC("c", SRC, SRCFLAGS...) {
- .CMD=$_SRC_c($SRC $SRCFLAGS)
+ .CMD=$_SRC_C_CMD_NEW
.SEM=target_sources PRIVATE ${input:SRC} ${hide;output;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS $USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL)
+ .STRUCT_CMD=yes
}
# tag:src-processing
@@ -3287,12 +3305,14 @@ when ($CLANG == "yes") {
${pre=-Wno-implicit-fallthrough -fno-profile-instr-generate -fno-coverage-mapping SKIP ;ext=.rl5:SRC} \
${pre=-Wno-implicit-fallthrough -fno-profile-instr-generate -fno-coverage-mapping SKIP ;ext=.rl6:SRC} \
${pre=-Wno-implicit-fallthrough -fno-profile-instr-generate -fno-coverage-mapping SKIP ;ext=.pyx:SRC}
+ _LANG_CFLAGS_RL=-Wno-implicit-fallthrough -fno-profile-instr-generate -fno-coverage-mapping
}
otherwise {
_LANG_CFLAGS_FILTER=\
${pre=-Wno-implicit-fallthrough SKIP ;ext=.rl5:SRC} \
${pre=-Wno-implicit-fallthrough SKIP ;ext=.rl6:SRC} \
${pre=-Wno-implicit-fallthrough SKIP ;ext=.pyx:SRC}
+ _LANG_CFLAGS_RL=-Wno-implicit-fallthrough
}
# tag:src-processing
@@ -3310,16 +3330,24 @@ macro _LANG_CFLAGS(SRC) {
# ymake bug workaround: variables followed a macros call in .CMD are not substituted and are placed in result as is
# Pack macro call into a variable and use it in _SRC_CPP_CMD instead of macro call
_LANG_CFLAGS_VALUE=
+_LANG_CFLAGS_VALUE_NEW=
when ($CLANG == "yes" || $CLANG_CL == "yes" || $GCC == "yes") {
_LANG_CFLAGS_VALUE=$_LANG_CFLAGS(${noext:SRC})
+ _LANG_CFLAGS_VALUE_NEW=\
+ ${pre=$_LANG_CFLAGS_RL;clear;ext=.rl5;noext:SRC} \
+ ${pre=$_LANG_CFLAGS_RL;clear;ext=.rl6;noext:SRC} \
+ ${pre=$_LANG_CFLAGS_RL;clear;ext=.pyx;noext:SRC}
}
# Allows to add single compilation unit name to the node's 'kv' section.
# This is used by the coverage machinery to instrument only the necessary sources
# when --coverage-prefix-filter <rootrelpath> is specified. For more info see DEVTOOLSSUPPORT-16891
SCU_NAME_KV=
+SCU_NAME_KV_NEW=
+SCU_NAME_KV_NEW_BODY=scu_name ${input:SRC}
when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no" && $USE_SCU_VALUE == "yes") {
SCU_NAME_KV=${hide;kv:"scu_name $KV_VAL"}
+ SCU_NAME_KV_NEW=${hide;kv:SCU_NAME_KV_NEW_BODY}
}
macro _ADD_SCU_NAME(KV_VAL) {