Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove warnings #95

Merged
merged 2 commits into from
Sep 12, 2024
Merged

Remove warnings #95

merged 2 commits into from
Sep 12, 2024

Conversation

rtobar
Copy link
Contributor

@rtobar rtobar commented Sep 4, 2024

When compiling the latest master on gcc 13.2.0 (Ubuntu 24.04.1) the following warnings were produced, which this PR fixes:

/home/rtobar/scm/git/ClangBuildAnalyzer/src/BuildEvents.cpp:528:29: warning: multi-character character constant [-Wmultichar]
  528 | const uint32_t kFileMagic = 'CBA0';
      |                             ^~~~~~
/home/rtobar/scm/git/ClangBuildAnalyzer/src/BuildEvents.cpp: In function ‘void DebugPrintEvents(const BuildEvents&, const BuildNames&)’:
/home/rtobar/scm/git/ClangBuildAnalyzer/src/BuildEvents.cpp:60:35: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 4 has type ‘long int’ [-Wformat=]
   60 |         printf("%4zi: t=%i t1=%7lld t2=%7lld par=%4i ch=%4zi det=%.*s\n", i, (int) event.type, event.ts, event.ts+event.dur, event.parent.idx, event.children.size(), (int)namesSubstr.size(), namesSubstr.data());
      |                               ~~~~^                                                            ~~~~~~~~
      |                                   |                                                                  |
      |                                   long long int                                                      long int
      |                               %7ld
/home/rtobar/scm/git/ClangBuildAnalyzer/src/BuildEvents.cpp:60:44: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 5 has type ‘long int’ [-Wformat=]
   60 |         printf("%4zi: t=%i t1=%7lld t2=%7lld par=%4i ch=%4zi det=%.*s\n", i, (int) event.type, event.ts, event.ts+event.dur, event.parent.idx, event.children.size(), (int)namesSubstr.size(), namesSubstr.data());
      |                                        ~~~~^                                                             ~~~~~~~~~~~~~~~~~~
      |                                            |                                                                     |
      |                                            long long int                                                         long int
      |                                        %7ld

@aras-p
Copy link
Owner

aras-p commented Sep 12, 2024

The PRId64 is ugly to read, but oh well, that's what C does :( Thanks!

@aras-p
Copy link
Owner

aras-p commented Sep 12, 2024

Uhh looks like my Github actions are out of date, I'll blindly merge this and will try to upgrade those later on.

@aras-p aras-p merged commit e9b55c1 into aras-p:main Sep 12, 2024
0 of 3 checks passed
@rtobar rtobar deleted the remove-warnings branch September 12, 2024 14:47
@rtobar
Copy link
Contributor Author

rtobar commented Sep 12, 2024

Thanks @aras-p for taking the time, much appreciated! Yes, the print format specifiers are a pain for portable C/C++, one day you might be able to port to fmtlib or std::format. Thanks again for the project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants