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

Controlled handling of spacing before a pointer '*'. #4199

Open
JosiahdpGit opened this issue Jan 15, 2024 · 2 comments
Open

Controlled handling of spacing before a pointer '*'. #4199

JosiahdpGit opened this issue Jan 15, 2024 · 2 comments

Comments

@JosiahdpGit
Copy link

CURRENT VERSION:
Uncrustify-0.78.1-52-83bfd3e0a

ISSUE:
We cannot control the spacing before ‘*’, in this case.

EXAMPLE 1:
INPUT (written in *.c files):
typedef struct EXAMPLE_MENU_OPTION* EXAMPLE_HDL;

EXPECTED OUTPUT:
typedef struct EXAMPLE_MENU_OPTION *EXAMPLE_HDL;

ACTUAL OUTPUT:
typedef struct EXAMPLE_MENU_OPTION*EXAMPLE_HDL;
Error: A space is not added before the '*'.

EXAMPLE 2:
INPUT:
typedef struct EXAMPLE_MENU_OPTION * EXAMPLE_HDL;

OUTPUT:
typedef struct EXAMPLE_MENU_OPTION *EXAMPLE_HDL;
Our current configuration ignores the space before the '', so we can achieve the format we want. However, we do not want to ignore the space before, and only have force/remove.
It is correct that the space is removed after the '
'.

CONCLUSION:
I am struggling to see an option that forces a space to be put before the ‘*’ in this case, help here would be appreciated.
I can see a couple of options: a new configurable option/modifying an existing option like 'sp_before_unnamed_ptr_star' to account for this, or that I have missed an option in the configuration and this was possible all along.
Please could you advise me on options I may have missed?

Please let me know if there is any more information needed, and I will provide it if I can.

Uncrusify
uncrustify.txt

Debug .A
myExample_A.txt
Debug .p
myExample_p.txt

@guy-maurel
Copy link
Contributor

you need to use the option
sp_before_ptr_star = force

@JosiahdpGit
Copy link
Author

Hi,

We would prefer to not use that, and would rather more granular option(s).

For example, "sp_before_ptr_star = force" causes typecasting spacing that we do not want.
INPUT:
( void* )( var )
EXPECTED:
( void* )( var )
OUTPUT:
( void * )( var )
There is a space added before the asterisk.

Note -
The italic writing in the issue description was not intended. There are supposed to be asterisks between the ''.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants