Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CompleteDefinition of struct being dragged into output because of union fields #113

Merged
merged 1 commit into from
Aug 16, 2024

Conversation

giulianobelinassi
Copy link
Collaborator

On the following example:

struct ll {
  union {
    unsigned long key;
    void *key_ptr;
  };
  struct ll *next;
};

Even if we don't need the full definition of ll it is dragged into the output because when analyzing this union field it tries to go up and set struct ll as having its body necessary once there was no way for it to know that it went there as a consequence of adding struct ll to the closure, rather than it being there because of a foward union declaration inside a struct. This commit fixes this by pushing the Decls into a stack as a way to know which declarations we are currently analyzing.

… union field

On the following example:
```
struct ll {
  union {
    unsigned long key;
    void *key_ptr;
  };
  struct ll *next;
};
```
Even if we don't need the full definition of `ll` it is dragged into
the output because when analyzing this `union` field it tries to go
up and set `struct ll` as having its body necessary once there was
no way for it to know that it went there as a consequence of adding
`struct ll` to the closure, rather than it being there because of
a foward union declaration inside a struct.  This commit fixes
this by pushing the Decls into a stack as a way to know which
declarations we are currently analyzing.

Signed-off-by: Giuliano Belinassi <[email protected]>
@marcosps
Copy link
Collaborator

it reduced the LoC of cmdline_proc_show from 105 to 67! 🚢 it!

@giulianobelinassi giulianobelinassi merged commit b68f4e6 into SUSE:main Aug 16, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants