Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

aligning function declarations in clang-format

I have problem with function declaration alignment.

Consider:

RplInstanceS* RplGetInstance(inst_t instID, uint8_t createFlag);
RplDagS* RplGetDag(RplInstanceS* inst, RplAddrS* dagID, uint8_t createFlag);
void RplFreeInstance(RplInstanceS* inst, uint8_t forced);
void ResetDioTrickle(RplDagS* dag);
RplDagS* GetNextInuseDag(int* state);
void    RplFreeAllInstances(void);
uint8_t CountAllInstances(void);
uint8_t StartAllInstances(void);

I was hoping there could be a clang-format option to convert it to:

RplInstanceS* RplGetInstance(inst_t instID, uint8_t createFlag);
RplDagS*      RplGetDag(RplInstanceS* inst, RplAddrS* dagID, uint8_t createFlag);
void          RplFreeInstance(RplInstanceS* inst, uint8_t forced);
void          ResetDioTrickle(RplDagS* dag);
RplDagS*      GetNextInuseDag(int* state);
void          RplFreeAllInstances(void);
uint8_t       CountAllInstances(void);
uint8_t       StartAllInstances(void);
like image 628
takladev Avatar asked Nov 16 '25 22:11

takladev


1 Answers

There is no option specific to functions but there is the AlignConsecutiveDeclarations option which if set to true aligns consecutive declarations.

This can be used along with PointerAlignment option with value set to PAS_Left (in configuration: Left) which will align pointer to the left.

The combination of these two options should give you what you are looking for.

like image 153
P.W Avatar answered Nov 18 '25 10:11

P.W



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!