Page MenuHomeFreeBSD

pmc gcc fixups
ClosedPublic

Authored by rlibby on Jun 9 2018, 8:49 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 12 2024, 2:41 AM
Unknown Object (File)
Mar 12 2024, 2:38 AM
Unknown Object (File)
Mar 12 2024, 2:38 AM
Unknown Object (File)
Mar 12 2024, 2:38 AM
Unknown Object (File)
Mar 8 2024, 4:27 AM
Unknown Object (File)
Jan 4 2024, 6:13 AM
Unknown Object (File)
Jan 4 2024, 6:13 AM
Unknown Object (File)
Jan 4 2024, 6:13 AM
Subscribers

Details

Reviewers
mmacy
Commits
rS334957: pmc gcc fixups
Summary

Fix the build of lib/libpmc and usr.sbin/pmc for gcc on amd64.

Test Plan

make CROSS_TOOLCHAIN=amd64-gcc TARGET=amd64 buildworld
make buildworld

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Jun 9 2018, 8:56 PM
usr.sbin/pmc/Makefile
8–12 ↗(On Diff #43521)

@dim, I marked you as a subscriber in case you might have a comment on the right fix for this. We use -Wredundant-decls for gcc builds and so gcc complains about __throw_runtime_error in libc++. If you have an idea about which header ought to have the decl upstream (or some other fix) I can work up a patch for that.

lib/libpmc/Makefile
13 ↗(On Diff #43521)

Rather use:

CWARNFLAGS.gcc+= -Wno-error=shadow

or better:

CWARNFLAGS.gcc+= -Wno-shadow

if the warning(s) are not actionable.

usr.sbin/pmc/Makefile
8–12 ↗(On Diff #43521)

We're probably the only ones in the world compiling libc++'s headers with -Wsystem-headers, so these kind of warnings are only seen by us...

In any case, shutting up the warning is fine with me, I never saw the value in warning about redundant declarations anyway: if they declarations are the same, it does not matter at all, and if they are different, it is (or at least should be) a compile error.

Similar to above, you can use:

CWARNFLAGS.gcc+= -Wno-error=redundant-decls

or better:

CWARNFLAGS.gcc+= -Wno-redundant-decls

if the warnings are non-actionable.

usr.sbin/pmc/cmd_pmc_filter.cc
235 ↗(On Diff #43521)

This kind of nastiness would not be needed if you'd use new[] and delete[]. ;-)

lib/libpmc/Makefile
13 ↗(On Diff #43521)

Okay. I'll check that that works. The shadowing occurs in the API (name collision between public procedure name and structure name) and it's probably not worth making an API change to suppress this.

usr.sbin/pmc/Makefile
8–12 ↗(On Diff #43521)

Right, it's a bit of a pain to maintain, since we don't specify the equivalent warning from clang. Maybe we should just stop specifying it for gcc.

Anyway, my concern was that as FreeBSD grows more C++ code, we may run into this some more.

Yes, this one is also not actionable. I'll test your suggestion.

usr.sbin/pmc/cmd_pmc_filter.cc
235 ↗(On Diff #43521)

Yes...

I made the minimal fix here because it wasn't clear to me where (or if???) this memory is freed--or if it is just leaked.

dim feedback: use CWARNFLAGS.gcc for warning suppression

This revision now requires review to proceed.Jun 9 2018, 10:28 PM
usr.sbin/pmc/cmd_pmc_filter.cc
235 ↗(On Diff #43521)

You're welcome to "fix". But aggressively freeing things on exit() doesn't strike me as particularly good use of one's attention.

usr.sbin/pmc/cmd_pmc_filter.cc
235 ↗(On Diff #43521)

Ah, it's only called once?

No, I'll let it be, I'm just trying to get the build working, I'm not trying to police anything here :)

Yes. I just want to make sure we're all clear on the magic of this thing called a 'process' for which the OS "garbage collects" its resources when it's done. ;-)

This revision was not accepted when it landed; it landed in state Needs Review.Jun 11 2018, 4:10 PM
Closed by commit rS334957: pmc gcc fixups (authored by rlibby). · Explain Why
This revision was automatically updated to reflect the committed changes.