File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,6 +88,10 @@ ENVIRONMENT VARIABLES
8888 are appended even if they already appear in the command line and they are
8989 always appended at the end of the command line.
9090
91+ *CSGCCA_ANALYZER_BIN*::
92+ If set to a non-empty string, csgcca will use the value as a path (relative
93+ or absolute) to analyzer binary.
94+
9195
9296BUGS
9397----
Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ const char *wrapper_debug_envvar_name = "DEBUG_CSCLNG";
3737
3838const char * analyzer_name = "clang" ;
3939
40+ const char * analyzer_bin_envvar_name = NULL ;
41+
4042const bool analyzer_is_cxx_ready = true;
4143
4244const bool analyzer_is_gcc_compatible = true;
Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ const char *wrapper_debug_envvar_name = "DEBUG_CSCPPC";
3838
3939const char * analyzer_name = "cppcheck" ;
4040
41+ const char * analyzer_bin_envvar_name = NULL ;
42+
4143const bool analyzer_is_cxx_ready = true;
4244
4345const bool analyzer_is_gcc_compatible = false;
Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ const char *wrapper_debug_envvar_name = "DEBUG_CSGCCA";
3737
3838const char * analyzer_name = "gcc" ;
3939
40+ const char * analyzer_bin_envvar_name = "CSGCCA_ANALYZER_BIN" ;
41+
4042const bool analyzer_is_cxx_ready = false;
4143
4244const bool analyzer_is_gcc_compatible = true;
Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ const char *wrapper_debug_envvar_name = "DEBUG_CSMATCH";
3737
3838const char * analyzer_name = "smatch" ;
3939
40+ const char * analyzer_bin_envvar_name = NULL ;
41+
4042const bool analyzer_is_cxx_ready = false;
4143
4244const bool analyzer_is_gcc_compatible = true;
Original file line number Diff line number Diff line change @@ -393,8 +393,14 @@ static void consider_running_analyzer(
393393 return ;
394394 }
395395
396- /* make sure that the analyzer process is named analyzer_name */
397- argv [0 ] = (char * ) analyzer_name ;
396+ const char * analyzer_name_actual = NULL ;
397+ if (analyzer_bin_envvar_name )
398+ analyzer_name_actual = getenv (analyzer_bin_envvar_name );
399+ if (!analyzer_name_actual || !analyzer_name_actual [0 ])
400+ analyzer_name_actual = analyzer_name ;
401+
402+ /* make sure that the analyzer process is named analyzer_name_actual */
403+ argv [0 ] = (char * ) analyzer_name_actual ;
398404
399405 /* make sure there is NULL at the end of argv[] */
400406 argv [argc_total - 1 ] = NULL ;
@@ -410,7 +416,7 @@ static void consider_running_analyzer(
410416 }
411417
412418 /* try to start analyzer */
413- pid_analyzer = launch_tool (analyzer_name , argv , /* del_args */ NULL );
419+ pid_analyzer = launch_tool (analyzer_name_actual , argv , /* del_args */ NULL );
414420
415421 /* FIXME: release also the memory allocated by asprintf() and
416422 read_custom_opts() */
Original file line number Diff line number Diff line change @@ -34,6 +34,13 @@ extern const char *wrapper_debug_envvar_name;
3434
3535extern const char * analyzer_name ;
3636
37+ /**
38+ * The name of the environment variable which value is the path (relative or
39+ * absolute) to the analyzer binary. If value of the environment variable is
40+ * non-empty string, it's used to override the value of analyzer_name.
41+ */
42+ extern const char * analyzer_bin_envvar_name ;
43+
3744extern const bool analyzer_is_cxx_ready ;
3845
3946extern const bool analyzer_is_gcc_compatible ;
You can’t perform that action at this time.
0 commit comments