Skip to content

Commit

Permalink
Suppress format string warnings in subfiling test (#3699)
Browse files Browse the repository at this point in the history
  • Loading branch information
derobins authored Oct 17, 2023
1 parent 45c4729 commit e2d40ef
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions testpar/t_subfiling_vfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,16 +382,20 @@ test_config_file(void)
substr = strstr(config_buf, "hdf5_file");
VRFY(substr, "strstr succeeded");

H5_GCC_CLANG_DIAG_OFF("format-nonliteral")
snprintf(scan_format, sizeof(scan_format), "hdf5_file=%%%zus", (size_t)(PATH_MAX - 1));
VRFY((sscanf(substr, scan_format, tmp_buf) == 1), "sscanf succeeded");
H5_GCC_CLANG_DIAG_ON("format-nonliteral")

VRFY((strcmp(tmp_buf, resolved_path) == 0), "strcmp succeeded");

substr = strstr(config_buf, "subfile_dir");
VRFY(substr, "strstr succeeded");

H5_GCC_CLANG_DIAG_OFF("format-nonliteral")
snprintf(scan_format, sizeof(scan_format), "subfile_dir=%%%zus", (size_t)(PATH_MAX - 1));
VRFY((sscanf(substr, scan_format, tmp_buf) == 1), "sscanf succeeded");
H5_GCC_CLANG_DIAG_ON("format-nonliteral")

VRFY((strcmp(tmp_buf, subfile_dir) == 0), "strcmp succeeded");

Expand Down

0 comments on commit e2d40ef

Please sign in to comment.