更新时间:2022-12-22 16:56:50
我不确定新的LLVM编译器是否仍然支持它,但是GCC具有未使用"属性,您可以使用它来抑制该警告:
I'm unsure if it's still supported in the new LLVM compiler, but GCC has an "unused" attribute you can use to suppress that warning:
BOOL saved __attribute__((unused)) = [moc save:&error];
或者(如果LLVM不支持以上内容),您可以将变量声明分成单独的一行,以确保无论宏是否扩展,该变量都将被使用":
Alternatively (in case LLVM doesn't support the above), you could split the variable declaration into a separate line, guaranteeing that the variable would be "used" whether the macro expands or not:
BOOL saved = NO;
saved = [moc save:&error];