Skip to content

Instantly share code, notes, and snippets.

@noahp
Last active August 31, 2018 17:43
Show Gist options
  • Save noahp/96ae471534898245ddf428fbbb637bb8 to your computer and use it in GitHub Desktop.
Save noahp/96ae471534898245ddf428fbbb637bb8 to your computer and use it in GitHub Desktop.
-Werror=format-extra-args bug
docker run -i -v"$(pwd):/mnt/workspace" -t zbeekman/nightly-gcc-trunk-docker-image
gcc -Wall -Werror /mnt/workspace/test.c
/mnt/workspace/test.c: In function 'main':
/mnt/workspace/test.c:57:12: error: too many arguments for format [-Werror=format-extra-args]
57 | printf("" PRIu32, 2);
| ^~
cc1: all warnings being treated as errors
test.c:
#include <inttypes.h>
#include <stdio.h>
int main() {
printf(PRIu32, 2); // doesn't fail
printf(PRIu32 "", 2); // doesn't fail
printf("" PRIu32, 2); // fails
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment