Bug 247206 - [GLib] Improvements for generate-api-header.py
Summary: [GLib] Improvements for generate-api-header.py
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Normal
Assignee: Michael Catanzaro
URL:
Keywords:
Depends on:
Blocks: GTK4
  Show dependency treegraph
 
Reported: 2022-10-28 11:28 PDT by Michael Catanzaro
Modified: 2022-11-07 07:23 PST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.