Skip to content

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Jun 5, 2021

This can be useful for testing. For example #22064 (comment) could use --with-append-cxxflags="-ftrivial-auto-var-init=pattern" without having to specify the default arguments again (-g -O2).

Copy link
Member

@fanquake fanquake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related discussion in #18892.

Note that -ftrivial-auto-var-init=zero seems to be going away. If I use that with (Apple) Clang I see:

clang++ a.cpp -std=c++17 -ftrivial-auto-var-init=zero      
clang: error: -ftrivial-auto-var-init=zero hasn't been enabled. Enable it at your own peril for benchmarking purpose only with -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang

Tested this PR + my change, using -ftrivial-auto-var-init=uninitialized.

@practicalswift
Copy link
Contributor

Concept ACK

Very nice to see! Let's kill the use of uninitialized memory (UUM) bug class! :)

@DrahtBot
Copy link
Contributor

DrahtBot commented Jun 5, 2021

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

No conflicts as of last run.

@laanwj
Copy link
Member

laanwj commented Jun 7, 2021

I'm honestly not sure why this warrants adding another build system configuration flag. For new people buildng from source having so many options only vaguely related to bitcoin's application is confusing. Why not pass it in through *FLAGS when needed?

Alternatively maybe we can group these kind of "warning: testing only" options together and have a single option. But I don't like having a separate one for it.

@maflcko
Copy link
Member Author

maflcko commented Jun 7, 2021

I agree that it is stupid to wrap each compiler option into a config option. While using CXXFLAGS is certainly possible, it is not straightforward, because it comes with some unexpected downsides, like disabling -g.

Compare the default CXXFLAGS:

  CXXFLAGS        =  -fdebug-prefix-map=$(abs_srcdir)=.  -fstack-reuse=none -Wstack-protector -fstack-protector-all -fcf-protection=full -fstack-clash-protection  -Wall -Wextra -Wformat -Wformat-security -Wvla -Wswitch -Wredundant-decls -Wunused-variable -Wdate-time -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Woverloaded-virtual -Wsuggest-override  -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-deprecated-copy   -g -O2 -fno-extended-identifiers

CXXFLAGS with "pattern":

  CXXFLAGS        =  -fdebug-prefix-map=$(abs_srcdir)=.  -Wstack-protector -fstack-protector-all -fcf-protection=full -fstack-clash-protection     -ftrivial-auto-var-init=pattern

@fanquake
Copy link
Member

fanquake commented Jun 9, 2021

I slightly misunderstood the intent when first reviewing, and agree with @laanwj here. Adding a new configuration option just to turn on a single compiler option is overkill. If it's not possible to achieve what you'd like, without downsides, when using CXXFLAGS, that seems like something we need to fix.

@laanwj
Copy link
Member

laanwj commented Jun 9, 2021

If it's not possible to achieve what you'd like, without downsides, when using CXXFLAGS, that seems like something we need to fix.

Agree, if CXXFLAGS as a mechanism to pass arbitrary options in is broken, that's what we need to fix. Alternatively, if that is not possible, to add a method to pass arbitrary options that actually works. Wrapping every option in its own configure option is a no-go.

@maflcko maflcko force-pushed the 2106-buildPattern branch 2 times, most recently from fadbe02 to faac838 Compare June 10, 2021 09:22
@maflcko maflcko changed the title build: Add --enable-trivial-auto-var-init-pattern option build: Add --with-append-cxxflags option Jun 10, 2021
@maflcko
Copy link
Member Author

maflcko commented Jun 10, 2021

Tried to addressed feedback

luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this pull request Jun 27, 2021
@maflcko maflcko force-pushed the 2106-buildPattern branch from faac838 to fa14c68 Compare July 7, 2021 10:11
Copy link
Member

@luke-jr luke-jr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

Seems the motivation is to add CXXFLAGS without losing whatever default flags autotools gave us previously. I probably won't use it, but it seems harmless and possibly useful to others, so why not?

@practicalswift
Copy link
Contributor

cr ACK fa14c68

Nice not having to repeat the defaults.

Nice not having to repeat the defaults.

@laanwj
Copy link
Member

laanwj commented Aug 18, 2021

But if we start doing this for cxxflags, where does it stop. I still disagree with this, it's a non-standard convention, It saves so little effort. But whatever if everyone else thinks it is a good idea.

@maflcko
Copy link
Member Author

maflcko commented Aug 18, 2021

Yeah, it would be nice if build systems were a bit more user friendly.

I guess I'll just keep typing "-g -O2" every time.

@maflcko maflcko closed this Aug 18, 2021
@maflcko maflcko deleted the 2106-buildPattern branch August 18, 2021 17:20
luke-jr pushed a commit to luke-jr/bitcoin that referenced this pull request May 21, 2022
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants