-
Notifications
You must be signed in to change notification settings - Fork 178
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
refactor: change project flag configuration behavior #1451
base: master
Are you sure you want to change the base?
Conversation
Fixes `(Project.get-config "cflags")` so that it actually returns the project's C flag field. Previously it was returning the project's preprocessor calls.
This commit alters the project configuration compiler flag setting behavior to allow users to override default project flags. Flag setting commands (cflag, libflag, pkgconfigflag) now take lists of strings as arguments. Previously, they were append-only and accepted string arguments. Now, to override flags, users can call: ``` (Project.get-config "cflag") => (...a bunch of default platform flags; "-wall" ...) (Project.config "cflag" '("-my" "-new" "-flags")) (Project.get-config "cflag") => ("-my" "-new" "-flags") ``` In order to append flags, users now need to `cons` to a `config-get`: ``` (Project.config "cflag" (cons "-new" (Project.get-config "cflag"))) ``` BREAKING CHANGE: Code that relies on the previous behavior will break, as calling these functions with non-list arguments is now an error. I considered a softer path whereby we'd overload the current behavior to avoid breaking existing users; however, the result would be confusing. Passing a list would result in overriding the project field while passing a single string would result in an append. A user might conceivably wonder why passing a list doesn't result in a multi-append. Ultimately I felt making a breaking change would be less confusing than this compatibility preserving behavior down the line.
Provides convenience macros for appending flags to project flag fields cflag, libflag, and pkgconfigflag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Seems to break the tests though?
Updates some project configuration calls in the Core library to follow the new configuration behavior (pass complete flag sets and not individual strings).
To account for the new flag setting configuration behavior.
Adds a preload eval to set the -Wnounknown-warning-option flag in clang -- this way, when different versions don't support our default flag set, they can still run tests. Otherwise passing an unknown flag to clang results in a compilation error.
Ok, so this PR gets our failing *nix builds green again by bypassing |
I'm wondering if we should just drop |
Possibly a good idea, but maybe we should also just remove usages of |
Even better! |
Does this need to pull in master for the tests to pass? |
@scolsen Should we try to get this merged? |
This PR changes the behavior of the project flag setting dynamic functions. Instead of appending a single string to the flagset, they now take a list of strings, which serve as the new flagset:
In order to append flags, users now need to
cons
to aconfig-get
:This is a breaking change, as passing a single string is now an error.
I considered overloading the behavior as an alternative so that we wouldn't break existing callers, but I feel this would ultimately lead to unintuitive behavior (calling with a single string appends while calling with a list of strings overrides ... users might wonder why the list doesn't append all the strings in the list instead).
This PR also fixes a bug w/ fetching project C flags and provides helper macros for appending flags to existing project flag sets given the new behavior.