Bug 247206

Summary: [GLib] Improvements for generate-api-header.py
Product: WebKit Reporter: Michael Catanzaro <mcatanzaro>
Component: WebKitGTKAssignee: Michael Catanzaro <mcatanzaro>
Status: RESOLVED FIXED    
Severity: Normal CC: bugs-noreply, mcatanzaro
Priority: P2    
Version: WebKit Nightly Build   
Hardware: PC   
OS: Linux   
Bug Depends on:    
Bug Blocks: 210100    

Description Michael Catanzaro 2022-10-28 11:28:20 PDT
generate-api-header.py has worked well enough so far, but there are a few problems:

 * It cannot expand USE(2022_GLIB_API) because its regex cannot handle underscores, and only handles flag names where all alphabetical characters occur before all numeric characters. The regex should be more permissive
 * It expands USE(FOO) to WTF_USE_FOO, but only HAVE(FOO) flags should receive the WTF_ prefix
 * It doesn't handle ENABLE_ at all
 * It translates FOO(BAR) to FOO_BAR, but we really want it to be translated to "defined(FOO_BAR) && FOO_BAR" because unifdef will ignore any directive that it cannot fully evaluate, leaving unwanted guards in the generated headers.
Comment 1 Michael Catanzaro 2022-10-30 06:26:11 PDT
(In reply to Michael Catanzaro from comment #0)
>  * It expands USE(FOO) to WTF_USE_FOO, but only HAVE(FOO) flags should
> receive the WTF_ prefix

This actually doesn't matter, since we control exactly which defines get passed to unifdef, and unifdef is supposed to remove them all. Since our normal build flags are not used, there is no requirement to expand things exactly the same way that the rest of the build would.
Comment 2 Michael Catanzaro 2022-10-30 06:59:09 PDT
Pull request: https://github.com/WebKit/WebKit/pull/5943
Comment 3 EWS 2022-11-07 07:23:00 PST
Committed 256403@main (40b3dbe8a327): <https://commits.webkit.org/256403@main>

Reviewed commits have been landed. Closing PR #5943 and removing active labels.