switch_tables
Controls the generation of switch tables.
Syntax
#pragma switch_tables on | off | reset
Remarks
When
on, the compiler translates switch statements into tables of addresses where each address in the lists corresponds to a case statement. Using tables improves the performance of switch statements but may increase the size of the executable code if there are many case statements or if the case statements are not contiguous.When
off, the compiler translates switch statements into a series of comparisons, one comparison for each case statement.read_only_switch_tables
Controls where tables for
switch statements are placed in object code.Syntax
#pragma read_only_switch_tables on | off | reset
Remarks
This option specifies where the compiler places executable code addresses for
switch statements. When this option is on, the compiler places these tables in a read-only section (.rodata), allowing the linker to place this object code in a ROM image instead of RAM.When this option is
off, the compiler places these switch tables in an object code section that is readable and writable (.data). Putting these tables in a read/write section allows relocation at runtime. The System V ABI, SuSE, YellowDog, and SDA PIC/PID application binary interfaces (ABIs) allow relocatable object code at runtime.Hello CrasyCat,
Is there any command line option instead of #pragma read_only_switch_tables on. I use makefiles and I am trying to know if is available such option, I haven't fount on app note 4094.
Thanks a lot and best regards,
ispd
Hello
I checked the command line option from PPC compiler delivered with V8.8.
There are 2 things you can try if you want to activate that pragma on the command line:
1- Use the option -pragma.
Here is the description of this option (according to on-line help):
-pragma ... # specify a #pragma for the compiler such as
# "#pragma ..."; quote the parameter if you
# provide an argument (i.e., '-pragma "myopt
# reset"')
2- Place the pragma in a .h file that you specify as a prefix file.
If you already have a prefix file add the pragma to this file.
Otherwise create a new .h file and use option -prefix to tell the compiler to use it as a prefix file.
This will make sure the file is automatically included in every C source file you are building.
CrasyCat