diff options
author | Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> | 2018-08-15 15:52:22 +0000 |
---|---|---|
committer | Prathamesh Kulkarni <prathamesh3492@gcc.gnu.org> | 2018-08-15 15:52:22 +0000 |
commit | 0cd020ae59e1131b8d7e23424c319c493745f0f8 (patch) | |
tree | f9611140f858ee59be030aa1f78bfa2bc7d63d19 /gcc/c | |
parent | bcee52c4b7ab4a47bb4c2426daa10f5b37968ac7 (diff) | |
download | gcc-0cd020ae59e1131b8d7e23424c319c493745f0f8.zip gcc-0cd020ae59e1131b8d7e23424c319c493745f0f8.tar.gz gcc-0cd020ae59e1131b8d7e23424c319c493745f0f8.tar.bz2 |
c-decl.c (start_decl): Do not warn if variables is named as main and is a local variable.
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
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c/c-decl.c | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 5931206..be714d2 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +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 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index da42add..1bbccdd 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -4700,7 +4700,8 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs, 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) |