================
@@ -1,19 +1,21 @@
-// RUN: %clang_analyze_cc1 
-analyzer-checker=optin.taint,core,security.ArrayBound -analyzer-config 
assume-controlled-environment=false -analyzer-output=text -verify %s
-// This file is for testing enhanced diagnostics produced by the 
GenericTaintChecker
+// RUN: %clang_analyze_cc1 
-analyzer-checker=optin.taint,core,security.ArrayBound -analyzer-config \
+// RUN: assume-controlled-environment=false -analyzer-output=text -verify %s
+
+// This file is for testing enhanced
+// diagnostics produced by the GenericTaintChecker
 
 typedef __typeof(sizeof(int)) size_t;
 int system(const char *command);
-size_t strlen( const char* str );
-char * strncat ( char * destination, const char * source, size_t num );
-
+size_t strlen(const char *str);
+char *strncat(char *destination, const char *source, size_t num);
 
 // invalid main function
 // expected-no-diagnostics
----------------
NagyDonat wrote:

Note that `int main(void)` is one of the two definitely standard-compliant ways 
to declare main [(cppreference 
link)](https://en.cppreference.com/w/c/language/main_function.html).

Of course there are no arguments that could be marked as tainted, so the 
checker has nothing to do -- but you shouldn't say that this declaration is 
invalid.

I think you should keep this test file and rename this to main_no_parameters 
(or something like that); and you should add a new test where `main` is 
declared with a signature that is actually invalid.

For example you should check that if you swap the order of arguments and 
declare `int main(char **argv, int argc)`, then the checker no longer reports a 
taint issue that it would report otherwise. (Which is correct because this 
invalid declaration is probably a compilation error -- if possible, try to 
suppress that error with a compiler flag to see the behavior of the checker.)

https://github.com/llvm/llvm-project/pull/178054
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to