boschresearch / blech

Blech is a language for developing reactive, real-time critical embedded software.
Apache License 2.0
72 stars 6 forks source link

Resolve potential name clash with _init #51

Closed FriedrichGretz closed 3 years ago

FriedrichGretz commented 3 years ago

Describe the todo The current code generation produces two C functions for every Blech activity: one for initialising the program counter and one that does the actual reactions.

The former has the same name extended by "_init" which could potentially clash with another codegenerated activity with the actual name "_init".

Task list

FriedrichGretz commented 3 years ago

The naming scheme is now

blc_init_01<module>01_<activity>

This name cannot clash with other activity names any more. Furthmore no other identifier will have a blc_init prefix because if "init" were a name in the program, say a module name, it would be surrounded by "01".

This change does not affect the main program level functions "tick" and "init". Those still follow the scheme

blc_blech_01<module>01_tick blc_blech_01<module>01_init

The "blc_blech" prefix prevents clashes with activity names that may be "tick" or "init". Note also, that in the second case the blech infix helps to distinguish a program initialisation "init" from an activity initialisation "init".

In this state the name mangling is (likely) unnecessary complex but prevents all foreseen clashes. The issue is closed.