初めましてTKOと申します。よろしくお願いします。
開発環境は下記の通りです。
開発環境:e2Studio 5.4.0.015(Windows8.1 pro)ツールチェインバージョン:v16.01(GNU)
GCC では #pragma GCC ~ で局所的に最適化の指定が可能なのでそれを使えばラクチンと思いますが
extern void hogera(int n); #pragma GCC optimize ("O2") void hoge(int n) { hogera(n); } #pragma GCC reset_options void piyo(int n) { hogera(n); }
GCC for Renesas 4.8.4.201701-GNURX Windows Toolchain (ELF) で試したところコンパイラの不具合か、わけわからん警告が出ますね。
$ rx-elf-gcc -S hoge.c hoge.c:3:9: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] #pragma GCC optimize ("O2") ^ hoge.c:5:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] { ^ hoge.c:5:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:5:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c: In function 'hoge': hoge.c:4:6: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] void hoge(int n) ^ hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] } ^ hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] hoge.c:4:6: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] void hoge(int n) ^ hoge.c:13:1: warning: RX FPU instructions do not support NaNs and infinities [enabled by default] } ^ $
コンパイラの出力は意図通りとなっているようです。
.file "hoge.c" .section P,"ax" .global _hoge .type _hoge, @function _hoge: bra _hogera .size _hoge, .-_hoge .global _piyo .type _piyo, @function _piyo: push.l r6 add #-4, r0, r6 mov.L r6, r0 mov.L r1, [r6] mov.L [r6], r1 bsr _hogera rtsd #8, r6-r6 .size _piyo, .-_piyo .ident "GCC: (GCC_Build_20161213) 4.8.4.201604-GNURX"
特定の警告を消したい場合は `-Wno-~' を指定すべきですが、この場合何を指定すべきかは不明です。
以上の方法ではなくて、e2studio の設定でファイル毎にコンパイルオプションを指定する方法を探すべきかもしれません。