I ran into an issue recently where the following toy example compiles cleanly using clang -ansi:
clang -ansi
int main(void) { for (int i = 0; 0; );
If you are trying to disable extensions in -ansi mode, then you want these warnings treated as errors: use -pedantic-errors instead of -pedantic, or -Werror (or both). For more fine-grained control over errors, see the Clang manual.
-ansi
-pedantic-errors
-pedantic
-Werror