2018-08-15 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
c/
* c-decl.c (start_decl): Do not warn if variables is named as main
and is a local variable.
testsuite/
* gcc.dg/wmain.c: New test.
From-SVN: r263562
+2018-08-15 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
+
+ * c-decl.c (start_decl): Do not warn if variables is named as main
+ and is a local variable.
+
2018-08-15 Iain Sandoe <iain@sandoe.co.uk>
PR c/19315
if (expr)
add_stmt (fold_convert (void_type_node, expr));
- if (TREE_CODE (decl) != FUNCTION_DECL && MAIN_NAME_P (DECL_NAME (decl)))
+ if (TREE_CODE (decl) != FUNCTION_DECL && MAIN_NAME_P (DECL_NAME (decl))
+ && TREE_PUBLIC (decl))
warning (OPT_Wmain, "%q+D is usually a function", decl);
if (initialized)
+2018-08-15 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
+
+ * gcc.dg/wmain.c: New test.
+
2018-08-15 Iain Sandoe <iain@sandoe.co.uk>
PR c/19315
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+
+int main; /* { dg-warning "'main' is usually a function" } */
+
+int foo()
+{
+ int main = 1; /* { dg-bogus "'main' is usually a function" } */
+ return main;
+}