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

Make compile definitions key/value #59

Merged
merged 1 commit into from
Apr 18, 2024
Merged

Make compile definitions key/value #59

merged 1 commit into from
Apr 18, 2024

Conversation

mwoehlke
Copy link
Member

Rewrite the specification of definitions to separate the definition name and value. In order to keep things sane for parsers, this necessitates always specifying definitions as a language-specific map. Also add an explicit 'all languages' key (which we probably should have had all along).

In theory, this makes it easier for consumers to perform certain operations such as querying whether a particular symbol is defined. It should also slightly simplify combining definitions from multiple components, or language-specific definitions with non-language-specific definitions (although, in practice, redefinitions on the command line are likely to be harmless).

Note that one potential complication of this approach is that it requires null values to be handled specially. This is required because we need a way to distinguish between -Dfoo and -Dfoo=, which may have different effects.

At least for now, the ability to specify explicitly undefined symbols has been dropped. Besides being rare, and potentially problematic for users, it turns out that tools may not support these either. (At least in theory, compile_flags can be used if necessary.)

Fixes #42.

Copy link
Collaborator

@bretbrownjr bretbrownjr left a comment

Choose a reason for hiding this comment

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

Thanks!

@bretbrownjr
Copy link
Collaborator

@mwoehlke Who's the second reviewer in cases like this?

Rewrite the specification of `definitions` to separate the definition
name and value. In order to keep things sane for parsers, this
necessitates always specifying definitions as a language-specific map.
Also add an explicit 'all languages' key (which we probably should have
had all along).

In theory, this makes it easier for consumers to perform  certain
operations such as querying whether a particular symbol is defined. It
should also slightly simplify combining definitions from multiple
components, or language-specific definitions with non-language-specific
definitions (although, in practice, redefinitions on the command line
are likely to be harmless).

Note that one potential complication of this approach is that it
requires null values to be handled specially. This is required because
we need a way to distinguish between `-Dfoo` and `-Dfoo=`, which may
have different effects.

At least for now, the ability to specify explicitly undefined symbols
has been dropped. Besides being rare, and potentially problematic for
users, it turns out that tools may not support these either. (At least
in theory, `compile_flags` can be used if necessary.)
@mwoehlke
Copy link
Member Author

mwoehlke commented Apr 18, 2024

Who's the second reviewer in cases like this?

Me. 🙂

The intent of the rules is that changes are "signed off" by at least two authorized reviewers, with self-review allowed. That leaves a hole that I don't know how to "fix" in that a PR from an authorized reviewer needs a maintainer or third authorized reviewer, but the intent is to enforce that a change from some random contributor needs two sign-offs.

If I could, I'd tell GitHub to allow the author to approve their own PR and to count that against the two-person rule, but AFAIK there's no way to do that. That being the case, it's intended that maintainers (i.e. me) will override the rule in most cases.


FYI, the force push was just this trivial typo fix:

diff --git a/schema.rst b/schema.rst
index 8c6b829..8e56a06 100644
--- a/schema.rst
+++ b/schema.rst
@@ -286,7 +286,7 @@ Each key in the inner map(s) is the name of a compile definition,
 such that e.g. ``-Dkey=value`` is passed to the compiler.
 A value may be |null|, indicating a definition with no value
 (e.g. ``-Dkey`` is passed to the compiler).
-Note that an *empty* string indicated ``-Dkey=``,
+Note that an *empty* string indicates ``-Dkey=``,
 which may have a different effect than ``-Dkey``.
 
 The outer map is used to describe

(Note "indicates" vs. "indicated".)

@mwoehlke mwoehlke merged commit 22edc78 into master Apr 18, 2024
3 checks passed
@mwoehlke mwoehlke deleted the defs-are-key-value branch April 18, 2024 18:00
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.

Definitions are keys and values
2 participants