Skip to content

Conversation

vasild
Copy link
Contributor

@vasild vasild commented May 3, 2020

Introduce a macro APPEND_FLAG_IF_AVAILABLE() and use that.

@maflcko
Copy link
Member

maflcko commented May 3, 2020

Concept ACK b26f8a0

@brakmic
Copy link
Contributor

brakmic commented May 3, 2020

Concept ACK b26f8a0

@practicalswift
Copy link
Contributor

Concept ACK

Very nice initiative: this repetition has annoyed me :)

@DrahtBot
Copy link
Contributor

DrahtBot commented May 3, 2020

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

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

Concept ACK.

@@ -333,31 +333,36 @@ if test x$use_sanitizers != x; then
]],[[]])])
fi

dnl APPEND_FLAG_IF_AVAILABLE([APPEND_TO_THIS_VARIABLE], [-WallExtra])
AC_DEFUN([APPEND_FLAG_IF_AVAILABLE], [
Copy link
Contributor

Choose a reason for hiding this comment

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

Could also define SET_FLAG_IF_AVAILABLE and use throughout.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would be a little bit less straight forward. While such code would definitely benefit from it:

AX_CHECK_COMPILE_FLAG([-msse4.2],[[SSE42_CXXFLAGS="-msse4.2"]],,[[$CXXFLAG_WERROR]])

and become:

SET_FLAG_IF_AVAILABLE([SSE42_CXXFLAGS], [-msse4.2])

there are other usages where the code calls AC_MSG_ERROR() if the flag is not available or does not compile with an additional $CXXFLAG_WERROR.

I will consider this as a separate PR.

Copy link
Contributor

@promag promag May 5, 2020

Choose a reason for hiding this comment

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

Yeah didn't check if all follow the same pattern. Separate PR is fine.

@fanquake
Copy link
Member

fanquake commented May 5, 2020

Concept ~0. Saving same verbosity is nice, but the downsides are now having a macro that obscures what's happening, and is applied inconsistently throughout configure; less than half of our AX_CHECK_COMPILE_FLAG calls are replaced with it.

This approach would also not work with the change currently proposed in #18882 (we'd end up with duplicate -Wformat flags). So let's decide how we want to fix the issue in that PR, before merging something like this.

@vasild
Copy link
Contributor Author

vasild commented May 11, 2020

Rebased.

@vasild vasild force-pushed the avoid_repetitions_in_configure.ac branch from e5d3519 to c635ea8 Compare May 13, 2020 12:31
@vasild
Copy link
Contributor Author

vasild commented May 13, 2020

Rebased.

@vasild
Copy link
Contributor Author

vasild commented May 28, 2020

Rebased.

@vasild
Copy link
Contributor Author

vasild commented Jun 4, 2020

Rebased.

@vasild vasild force-pushed the avoid_repetitions_in_configure.ac branch from e6e1a0c to 86a0367 Compare June 4, 2020 19:26
@vasild
Copy link
Contributor Author

vasild commented Jun 4, 2020

Rebased.

@vasild
Copy link
Contributor Author

vasild commented Jun 8, 2020

Rebased.

Introduce a macro APPEND_FLAG_IF_AVAILABLE() and use that.
@vasild vasild force-pushed the avoid_repetitions_in_configure.ac branch from 7b72014 to 2a72758 Compare July 16, 2020 08:51
@vasild
Copy link
Contributor Author

vasild commented Jul 16, 2020

Rebased due to conflicts.

@fanquake, what's your take on this, now that #18882 has been merged?

@fanquake
Copy link
Member

@fanquake, what's your take on this, now that #18882 has been merged?

My take is still the same as my comment above. I'm not convinced introducing an inconsistently used macro, to essentially save some line length, is a huge win. In general I prefer that we are explicit/verbose when it comes to anything build system related.

@DrahtBot
Copy link
Contributor

🐙 This pull request conflicts with the target branch and needs rebase.

Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft".

@vasild
Copy link
Contributor Author

vasild commented Aug 18, 2020

Closing this because it needs frequent rebasing and it is not moving anywhere.

It has 4 "Concept ACK" and 1 "Concept ~0".

The point of this PR is to save repetitions, not line length. The introduced macro is not used everywhere (to replace AX_CHECK_COMPILE_FLAG), but on the places where it is used the usage is consistent.

If there is interest in this, I would be happy to reopen and rebase it.

@vasild vasild closed this Aug 18, 2020
@hebasto
Copy link
Member

hebasto commented Aug 18, 2020

I tend to agree with @fanquake:

In general I prefer that we are explicit/verbose when it comes to anything build system related.

@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 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.

8 participants