godotengine / godot-cpp

C++ bindings for the Godot script API
MIT License
1.7k stars 528 forks source link

Fix some style details in generation #1423

Closed AThousandShips closed 3 months ago

AThousandShips commented 6 months ago

Some minor output fixes that I came across while fixing some other bugs, this would generate things like:

static Object  *instance_from_id(int64_t instance_id);
Object * get_object() const;
virtual Error _get_packet(const uint8_t * *r_buffer, int32_t *r_buffer_size);

These are all now fixed

dsnopek commented 5 months ago

Thanks!

In my testing this fixes some of the style issues from the description, but creates some new ones.

For example, with MultiplayerPeerExtensnion::_get_packet(), it fixes the const uint8_t * *r_buffer turning it into const uint8_t **r_buffer, but it messes up the next argument, turning it from int32_t *r_buffer_size into int32_t*r_buffer_size (with no spaces at all).

I diff'd the generated code between master and this PR (rebased on master), and skimming through it, it's possible this one "pattern" is the only new issue created.

Here's the diff I generated, in case it's helpful: godot-cpp-pr-1423-diff.txt

AThousandShips commented 5 months ago

Thank you, will look at those cases, should be straightforward

AThousandShips commented 3 months ago

Should be good now!

(Pushed on top of https://github.com/godotengine/godot-cpp/pull/1490 for the time being for conflicts)

AThousandShips commented 3 months ago

I'll see if I can find those, but I'm fine merging this and checking later, I'll push in a few hours if I do, otherwise I'll do it later

AThousandShips commented 3 months ago

Fixed!

There are some other areas of style that might be improved in the future, will do some testing using clang-format later but I think these will do well for the time being

Edit: Found a few more glaring cases I'll fix right now

AThousandShips commented 3 months ago

Thank you! Got some further fixes set up but still testing them and will open a PR when they are ready, they're more extensive but will (almost) make the generared code follow the style, i.e. won't be triggering anything in clang-format

dsnopek commented 2 months ago

Cherry-picked for 4.2 in PR https://github.com/godotengine/godot-cpp/pull/1527

dsnopek commented 2 months ago

Cherry-picked for 4.1 in PR https://github.com/godotengine/godot-cpp/pull/1529