[Freeciv-tickets] [freeciv] #48675: specenum generator

Back to archive index
OSDN Ticket System norep****@osdn*****
Thu Sep 21 11:52:28 JST 2023


#48675: specenum generator

  Open Date: 2023-09-19 15:02
Last Update: 2023-09-21 05:52

URL for this Ticket:
    https://osdn.net//projects/freeciv/ticket/48675
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=48675

---------------------------------------------------------------------

Last Changes/Comment on this Ticket:
2023-09-21 05:52 Updated by: cazfi

Comment:

These might live under gen_headers, or in their own subdirectory within it. It's the directory autotools build process first, so the results are available for the rest of the build.
With a separate directory, I don't see large number of files big problem. Sure, we need to list them all in the initial implementation, but adding new file later should be rare and easy enough. Separate header per enum would also allow us simply include the exact header where we currently have the definition, and thus there would be no new interdependency headaches.
The best solution, however, would be to allow .def to specify what ever amount of enums it wants, and matching *_gen.h gets generated by those same enums. Complicates the naming convention, though (can't have "the single" defined enum in file name)
meson.build currently lists only source files to compile. For *compilation* to work, it does not need to know regular headers. It would need to know list of these headers to generate.
Initial step (first subticket) should be possible without build system integration - expect developer to run the script manually, and keep the resulting header under version control. Shouldn't do that for a large number of generated headers, but just for the first.

---------------------------------------------------------------------
Ticket Status:

      Reporter: cazfi
         Owner: (None)
          Type: Patches
        Status: Open
      Priority: 5 - Medium
     MileStone: (None)
     Component: Bootstrap
      Severity: 5 - Medium
    Resolution: None
---------------------------------------------------------------------

Ticket details:

Adjusting specenum values can take a lot of effort, and that need for effort is often multiplied by the number of branches to backport the patch as the big change is unlikely to apply cleanly. The main problem is that we have to number the entries in the sources. So adding or removing entries necessitate changing all the entries that follow.
We could have just spec files describing the enum:
...
VAL_FOO, "foo name"
VAL_BAR, "bar name"
...
and a python source generator script producing a C header with the specenum definitions like they now are maintained by hand.


-- 
Ticket information of Freeciv project
Freeciv Project is hosted on OSDN

Project URL: https://osdn.net/projects/freeciv/
OSDN: https://osdn.net

URL for this Ticket:
    https://osdn.net/projects/freeciv/ticket/48675
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=48675



More information about the Freeciv-tickets mailing list
Back to archive index