Skip to content

Commit

Permalink
cswrap-util: do not wrap nvcc instrumented by cov-build
Browse files Browse the repository at this point in the history
  • Loading branch information
kdudka committed Jun 19, 2024
1 parent b0d2bd1 commit a852f28
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/cswrap-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@
#include <string.h>
#include <unistd.h> /* for getcwd() */

/* return true if `str` ends with `suffix` */
static bool endsWith(const char *str, const char *suffix)
{
const size_t len = strlen(str);
const size_t suffixLen = strlen(suffix);
if (len < suffixLen)
return false;

str += (len - suffixLen);
return STREQ(str, suffix);
}

/* delete the given argument from the argv array */
void del_arg_from_argv(char **argv)
{
Expand Down Expand Up @@ -179,6 +191,10 @@ bool is_ignored_file(const char *name)
if (MATCH_PREFIX(name, "/tmp/cov-mockbuild/"))
return true;

/* used by cov-build while instrumenting nvcc */
if (endsWith(name, ".cudafe1.cpp"))
return true;

/* used by librdkafka-1.6.0 */
if (MATCH_PREFIX(name, "_mkltmp"))
return true;
Expand Down
3 changes: 3 additions & 0 deletions tests/0006-add-del-cflags/runtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@ do_check g++ "-Wextra -g -O0 -Wno-extra" "-Wextra -g -O0 -Wno-extra -Wall -Wextr

# preserving flags for conftest.c
do_check gcc "conftest.c -Werror" "conftest.c -Werror"

# preserving flags for nvcc instrumented by cov-build
do_check gcc "/tmp/foo_bar.cudafe1.cpp -Werror" "/tmp/foo_bar.cudafe1.cpp -Werror"

0 comments on commit a852f28

Please sign in to comment.