Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/csgcca.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ ENVIRONMENT VARIABLES
are appended even if they already appear in the command line and they are
always appended at the end of the command line.

*CSGCCA_ANALYZER_BIN*::
If set to a non-empty string, csgcca will use the value as a path (relative
or absolute) to analyzer binary.


BUGS
----
Expand Down
2 changes: 2 additions & 0 deletions src/csclng.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const char *wrapper_debug_envvar_name = "DEBUG_CSCLNG";

const char *analyzer_name = "clang";

const char *analyzer_bin_envvar_name = NULL;

const bool analyzer_is_cxx_ready = true;

const bool analyzer_is_gcc_compatible = true;
Expand Down
2 changes: 2 additions & 0 deletions src/cscppc.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ const char *wrapper_debug_envvar_name = "DEBUG_CSCPPC";

const char *analyzer_name = "cppcheck";

const char *analyzer_bin_envvar_name = NULL;

const bool analyzer_is_cxx_ready = true;

const bool analyzer_is_gcc_compatible = false;
Expand Down
2 changes: 2 additions & 0 deletions src/csgcca.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const char *wrapper_debug_envvar_name = "DEBUG_CSGCCA";

const char *analyzer_name = "gcc";

const char *analyzer_bin_envvar_name = "CSGCCA_ANALYZER_BIN";

const bool analyzer_is_cxx_ready = false;

const bool analyzer_is_gcc_compatible = true;
Expand Down
2 changes: 2 additions & 0 deletions src/csmatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const char *wrapper_debug_envvar_name = "DEBUG_CSMATCH";

const char *analyzer_name = "smatch";

const char *analyzer_bin_envvar_name = NULL;

const bool analyzer_is_cxx_ready = false;

const bool analyzer_is_gcc_compatible = true;
Expand Down
12 changes: 9 additions & 3 deletions src/cswrap-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,14 @@ static void consider_running_analyzer(
return;
}

/* make sure that the analyzer process is named analyzer_name */
argv[0] = (char *) analyzer_name;
const char *analyzer_name_actual = NULL;
if (analyzer_bin_envvar_name)
analyzer_name_actual = getenv(analyzer_bin_envvar_name);
if (!analyzer_name_actual || !analyzer_name_actual[0])
analyzer_name_actual = analyzer_name;

/* make sure that the analyzer process is named analyzer_name_actual */
argv[0] = (char *) analyzer_name_actual;

/* make sure there is NULL at the end of argv[] */
argv[argc_total - 1] = NULL;
Expand All @@ -410,7 +416,7 @@ static void consider_running_analyzer(
}

/* try to start analyzer */
pid_analyzer = launch_tool(analyzer_name, argv, /* del_args */ NULL);
pid_analyzer = launch_tool(analyzer_name_actual, argv, /* del_args */ NULL);

/* FIXME: release also the memory allocated by asprintf() and
read_custom_opts() */
Expand Down
7 changes: 7 additions & 0 deletions src/cswrap-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ extern const char *wrapper_debug_envvar_name;

extern const char *analyzer_name;

/**
* The name of the environment variable which value is the path (relative or
* absolute) to the analyzer binary. If value of the environment variable is
* non-empty string it's used to override the value if analyzer_name.
*/
extern const char *analyzer_bin_envvar_name;

Comment thread
sibeream marked this conversation as resolved.
extern const bool analyzer_is_cxx_ready;

extern const bool analyzer_is_gcc_compatible;
Expand Down