1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GCCの警告オプション設定

Last updated at Posted at 2019-10-25

オプション一覧

gcc -Q --help=warnings

にて確認ができる。出力例は以下

特定の警告を一時的に無効にする

# 全ての警告メッセージを抑制したい場合
export CFLAGS="-w"
export CXXFLAGS="-w"

./configure
make
# -Wnoを指定すれば、その警告は無効できる

## c
# 暗黙の関数宣言
export CFLAGS="-Wno-implicit-function-declaration"
# 廃止予定(deprecated)
export CFLAGS="$CFLAGS -Wno-deprecated-declarations"
#
export CFLAGS="$CFLAGS -Wno-stringop-overflow"

## cpp
# intからポインタへの変換
export CXXFLAGS="-Wno-int-to-pointer-cast"
#
export CXXFLAGS="$CXXFLAGS -Wno-class-memaccess -Wno-conversion -Wno-sign-conversion"

# configure より前に CFLAGS を指定しておく必要がある。
./configure
make
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?