New user self-registration is disabled due to spam. For an account please email bugs-admin@lists.llvm.org with your e-mail address and full name.

Bug 40604 - modernize-avoid-c-arrays should ignore 'int main(int argc, const char* argv[])'
Summary: modernize-avoid-c-arrays should ignore 'int main(int argc, const char* argv[])'
Status: RESOLVED FIXED
Alias: None
Product: clang-tools-extra
Classification: Unclassified
Component: clang-tidy (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P enhancement
Assignee: Roman Lebedev
URL:
Keywords:
Depends on:
Blocks: release-8.0.0
  Show dependency tree
 
Reported: 2019-02-05 04:53 PST by Pavel Kryukov
Modified: 2019-02-07 03:10 PST (History)
6 users (show)

See Also:
Fixed By Commit(s): 353327


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Kryukov 2019-02-05 04:53:02 PST
> main.cpp:19:27: warning: do not declare C-style arrays, use std::array<>
> instead [cppcoreguidelines-avoid-c-arrays]
> int main(int argc, const char* argv[])

I suppose main should be treated in a same manner as extern "C" functions.
Comment 1 Roman Lebedev 2019-02-05 11:17:59 PST
(In reply to Pavel Kryukov from comment #0)
> > main.cpp:19:27: warning: do not declare C-style arrays, use std::array<>
> > instead [cppcoreguidelines-avoid-c-arrays]
> > int main(int argc, const char* argv[])
> 
> I suppose main should be treated in a same manner as extern "C" functions.

Uh oh, i suppose so.
I have not seen this warning until now because apparently i always used "char** argv".
Comment 2 Roman Lebedev 2019-02-05 11:29:36 PST
I'll try to submit a patch tomorrow.
Comment 3 Roman Lebedev 2019-02-05 13:59:08 PST
https://reviews.llvm.org/D57787
Comment 4 Roman Lebedev 2019-02-06 11:17:56 PST
r353327, please backport to 8.0
Comment 5 Hans Wennborg 2019-02-07 03:04:23 PST
(In reply to Roman Lebedev from comment #4)
> r353327, please backport to 8.0

r353391. Thanks!
Comment 6 Pavel Kryukov 2019-02-07 03:06:35 PST
Thanks!
Comment 7 Roman Lebedev 2019-02-07 03:10:49 PST
Thanks everyone!