Skip to content

Commit cd394d6

Browse files
authored
Fix newly emerged warning from clang (#608)
and a warning from a recent code change in toktx.cc. The new clang warning has appeared, without a bump in the LLVM version number, because Emscripten releases pull the top of tree LLVM and our CI gets the latest Emscripten release. LLVM is in the final throes of developing their 15.0.0 release. As there is no version number change we've had to use the `__has_warning` pre-processor directive and thus modify the offending BasisU file. Note that MS VC++ also has `__has_warning` but with a different syntax so this fix uses the directive only when `__clang__` is defined.
1 parent ee40449 commit cd394d6

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

lib/basisu/transcoder/basisu_containers.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
#pragma GCC diagnostic push
1111
#pragma GCC diagnostic ignored "-Wunused-value"
1212
#pragma GCC diagnostic ignored "-Wclass-memaccess"
13+
#elif __clang__
14+
#if __has_warning("-Wdeprecated-builtins")
15+
#pragma clang diagnostic ignored "-Wdeprecated-builtins"
16+
#endif
1317
#endif
1418

1519
#if defined(__linux__) && !defined(ANDROID)

tools/toktx/toktx.cc

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -647,9 +647,6 @@ toktxApp::main(int argc, _TCHAR *argv[])
647647
int exitCode = 0;
648648
unsigned int componentCount = 1, faceSlice, level, layer, levelCount = 1;
649649
unsigned int levelWidth=0, levelHeight=0, levelDepth=0;
650-
// These initializations are to avoid compiler warnings.
651-
khr_df_transfer_e chosenOETF = KHR_DF_TRANSFER_UNSPECIFIED;
652-
khr_df_primaries_e chosenPrimaries = KHR_DF_PRIMARIES_UNSPECIFIED;
653650
struct _imageAttribs {
654651
khr_df_transfer_e oetf;
655652
khr_df_primaries_e primaries;
@@ -947,8 +944,6 @@ toktxApp::main(int argc, _TCHAR *argv[])
947944

948945
if (i == 0) {
949946
// First file.
950-
chosenOETF = image->getOetf();
951-
chosenPrimaries = image->getPrimaries();
952947

953948
if (image->getColortype() < Image::colortype_e::eR) { // Luminance type?
954949
if (image->getColortype() == Image::colortype_e::eLuminance) {
@@ -1290,9 +1285,9 @@ toktxApp::main(int argc, _TCHAR *argv[])
12901285
swizzle.c_str());
12911286
}
12921287

1293-
if (options.ktx2 && chosenPrimaries != KHR_DF_PRIMARIES_BT709) {
1288+
if (options.ktx2 && expectedAttribs.primaries != KHR_DF_PRIMARIES_BT709) {
12941289
KHR_DFDSETVAL(((ktxTexture2*)texture)->pDfd + 1, PRIMARIES,
1295-
chosenPrimaries);
1290+
expectedAttribs.primaries);
12961291
}
12971292
}
12981293

0 commit comments

Comments
 (0)