Suppress format string warnings in subfiling test (#3699)

This commit is contained in:
Dana Robinson 2023-10-17 11:05:20 -07:00 committed by GitHub
parent 45c4729799
commit e2d40ef16e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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");