Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cswrap-util: do not wrap nvcc instrumented by cov-build #40

Merged
merged 1 commit into from
Jun 20, 2024
Merged
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
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` */
kdudka marked this conversation as resolved.
Show resolved Hide resolved
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"