GNU gcc から Microsoft Visual C++ へ移植する際に -diag-enable port-win オプションを使用して一般的な構文の問題に関する警告を表示することができます。次に、このオプションの使用例を示します。
例 1:
$ cat -n attribute.c
1 int main()
2 {
3 int i __attribute__((unused));
4 return 0;
5 }
$ icc -c -diag-enable port-win attribute.c
attribute.c(3): 警告 #2133: 属性は GNU 拡張です。
int i __attribute__((unused));
例 2:
$ cat -n state_expr.c
1 int main()
2 {
3 int i = ({ int j; j = 1; j--; j;});
4 return i;
5 }
$ icc -c -diag-enable port-win state_expr.c
state_expr.c(3): 警告 #2132: ステートメント式は GNU 拡張です。
int i = ({ int j; j = 1; j--; j;});