Fix incorrect @propdef enum value names + add regression guard (#247)#250
Open
garyo wants to merge 1 commit into
Open
Fix incorrect @propdef enum value names + add regression guard (#247)#250garyo wants to merge 1 commit into
garyo wants to merge 1 commit into
Conversation
…#247) Several enum properties listed @propdef `values:` that did not match the actual string literals their value #defines expand to, so the generated openfx-cpp metadata advertised valid-value strings no host or plugin ever uses. The macro string values are ABI and are left untouched; only the metadata is corrected to match them: - Field props (FieldOrder, PropField, FieldExtraction, FieldToRender): OfxImageField* -> OfxField* (kOfxImageFieldNone == "OfxFieldNone") - PreMultiplication: OfxImage{,Un}PreMultiplied -> OfxImageAlpha{,Un}Premultiplied - HostPropNativeOrigin: add the leading "k" the string literals actually have (kOfxHostNativeOriginBottomLeft == "kOfxImageEffectHostProp...") - ColourManagementStyle: drop the erroneous "Prop" (kOfxImageEffectColourManagementNone == "OfxImageEffectColourManagementNone") The three irregularly-named value clusters (Field, PreMultiplication, NativeOrigin) get a header comment noting the name/value mismatch is ABI-locked and must not be copied as an example. (ColourManagementStyle is conventionally named; only its @propdef had a typo.) Guard: gen-props.py now emits a static_assert for every enum value (value string == its #define), mirroring the existing per-property asserts, and aborts generation if an `Ofx`-prefixed value names no macro. A reintroduced typo therefore fails the generator and, failing that, fails to compile. Verified by reintroducing a bad value. Also removed dead `nonProperties` entries in gen-props.py that excluded misspelled (extra-"Prop") ColourManagement value macros which never existed; the real value macros contain no "Prop" and were never collected as properties. Output is byte-identical. Regenerated openfx-cpp metadata and the property reference docs. The docs regen also picks up kOfxImageEffectPluginPropObsolete, whose generated docs were stale on main. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
bc47102 to
759c396
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #247.
Problem
Enum properties declare their valid values in
@propdef … values:. By convention each value is the string literal its value-#defineexpands to. Four clusters violated that, so the generatedopenfx-cppmetadata (ofxPropsMetadata.henum arrays) and the generated property docs advertised valid-value strings that no host or plugin actually uses — anything validating a real value against the metadata would reject it.The macro string values are wire/ABI and must not change (e.g.
kOfxImagePreMultipliedhas always been"OfxImageAlphaPremultiplied"). So this corrects only the metadata to match reality; no#definenames or values are touched.What changed
OfxImageFieldNone,…Lower, …OfxFieldNone,OfxFieldLower, ……PropPreMultiplicationOfxImagePreMultiplied,OfxImageUnPreMultipliedOfxImageAlphaPremultiplied,OfxImageAlphaUnPremultiplied…HostPropNativeOriginOfxImageEffectHostPropNativeOrigin{…}kOfxImageEffectHostPropNativeOrigin{…}(the literals really do start withk)…PropColourManagementStyleOfxImageEffectPropColourManagement{…}OfxImageEffectColourManagement{…}(no "Prop")¹
FieldOrder,PropField,FieldExtraction,FieldToRender. Thetrue/false/neededliteral enums are correct and untouched.Regression guard
Following the codebase's existing pattern (generated
static_assert(string_view("Ofx…") == string_view(kOfx…))for every property name),gen-props.pynow also:static_assertfor every enum value (value string == its #define), so drift fails to compile; andOfx-prefixed enum value names no macro — the typo class that can't be expressed as an assert. Verified: reintroducingOfxImagePreMultipliedmakesgen-props.pyexit 1 with a clear message.Also removed dead
nonPropertiesentries ingen-props.pythat listed misspelled (extra-"Prop") ColourManagement value macros which never existed; the real value macros contain no "Prop" so were never collected. Confirmed byte-identical output.Generated / regenerated
openfx-cpp/include/openfx/ofxPropsMetadata.h— corrected enum arrays + new per-value asserts.Documentation/.../ofxPropertiesReferenceGenerated.rst,ofxPropertySetsGenerated.rst— corrected value lists. The doc regen also picks upkOfxImageEffectPluginPropObsolete, whose generated docs were already stale onmain(incidental, unrelated to Incorrect @propdef enum value names. #247).Validation
gen-props.pyandgen-props-doc.pyboth run clean and are idempotent.#definenames or string values changed → no ABI impact.🤖 Generated with Claude Code