Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deleteのオーバーロードがGCCに怒られる対応 #386

Merged

Conversation

berryzplus
Copy link
Contributor

#381 の本対応です。

MinGW でデバッグビルドを行った場合に、
deleteのオーバーロード定義のところでビルドエラーが発生しています。

In file included from D:/eclipse4.6/eclipse/mingw/lib/gcc/x86_64-w64-mingw32/6.2
.0/include/c++/ext/new_allocator.h:33:0,
                 from D:/eclipse4.6/eclipse/mingw/lib/gcc/x86_64-w64-mingw32/6.2
.0/include/c++/x86_64-w64-mingw32/bits/c++allocator.h:33,
                 from D:/eclipse4.6/eclipse/mingw/lib/gcc/x86_64-w64-mingw32/6.2
.0/include/c++/bits/allocator.h:46,
                 from D:/eclipse4.6/eclipse/mingw/lib/gcc/x86_64-w64-mingw32/6.2
.0/include/c++/string:41,
                 from C:\gitroot\sakura-mygithub\sakura_core\StdAfx.h:64,
                 from C:\gitroot\sakura-mygithub\sakura_core\CAutoReloadAgent.cp
p:24:
D:/eclipse4.6/eclipse/mingw/lib/gcc/x86_64-w64-mingw32/6.2.0/include/c++/new:120
:6: error: declaration of 'void operator delete(void*) noexcept' has a different
 exception specifier
 void operator delete(void*) _GLIBCXX_USE_NOEXCEPT
      ^~~~~~~~

ポイントは declaration of 'void operator delete(void*) noexcept' has a differentの部分と考えられるのでシグニチャを合わせる対応を行います。MinGW版はまだビルドできないため、動作確認は行っていません。

@berryzplus
Copy link
Contributor Author

レビューをお願いします。

DEFINES= \
-DWIN32 \
-DWINVER=0x500 \
-D_WIN32_WINNT=0x500 \
-D_WIN32_IE=0x501 \
-DMINGW_HAS_SECURE_API=1 \
-DNOMINMAX \
-D_UNICODE \
-DUNICODE \
-DNDEBUG

34行目を -D_DEBUG に変えたときに発生するビルドエラーの対処です。

@m-tmatma
Copy link
Member

m-tmatma commented Sep 9, 2018

再現させるためにはどれを使ったらいいですか?
http://mergedoc.osdn.jp/

@m-tmatma
Copy link
Member

m-tmatma commented Sep 9, 2018

#407 はマージしました。

@berryzplus
Copy link
Contributor Author

pleiades 4.6.3 で再現しました。
環境依存じゃなさそうな気配です。
デバッグ版だけで起きるビルドエラーです。
ビルド順序の問題なら clean + stdafx で再現できるはず。

mingw32-make MYDEFINES=-D_DEBUG MYCFLAGS="-g -O0" clean stdafx

おんなじですが4.6.3で出たエラーメッセージです。

In file included from H:/pleiades-4.6.3-cpp-win-64bit-jre_20170422/pleiades/eclipse/mingw/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/ext/new_allocator.h:33:0

                 from H:/pleiades-4.6.3-cpp-win-64bit-jre_20170422/pleiades/eclipse/mingw/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/x86_64-w64-mingw32/bits/c++allocator.h:33,
                 from H:/pleiades-4.6.3-cpp-win-64bit-jre_20170422/pleiades/eclipse/mingw/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/bits/allocator.h:46,
                 from H:/pleiades-4.6.3-cpp-win-64bit-jre_20170422/pleiades/eclipse/mingw/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/string:41,
                 from StdAfx.h:64:
H:/pleiades-4.6.3-cpp-win-64bit-jre_20170422/pleiades/eclipse/mingw/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/new:120:6: error: declaration of 'void operator delete(void*) noexcept' has a different exception specifier
 void operator delete(void*) _GLIBCXX_USE_NOEXCEPT
      ^~~~~~~~
In file included from StdAfx.h:41:0:
config/build_config.h:98:7: note: from previous declaration 'void operator delete(void*)'
  void operator delete(void* p);
       ^~~~~~~~
In file included from H:/pleiades-4.6.3-cpp-win-64bit-jre_20170422/pleiades/eclipse/mingw/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/ext/new_allocator.h:33:0

                 from H:/pleiades-4.6.3-cpp-win-64bit-jre_20170422/pleiades/eclipse/mingw/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/x86_64-w64-mingw32/bits/c++allocator.h:33,
                 from H:/pleiades-4.6.3-cpp-win-64bit-jre_20170422/pleiades/eclipse/mingw/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/bits/allocator.h:46,
                 from H:/pleiades-4.6.3-cpp-win-64bit-jre_20170422/pleiades/eclipse/mingw/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/string:41,
                 from StdAfx.h:64:
H:/pleiades-4.6.3-cpp-win-64bit-jre_20170422/pleiades/eclipse/mingw/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/new:122:6: error: declaration of 'void operator delete [](void*) noexcept' has a different exception specifier
 void operator delete[](void*) _GLIBCXX_USE_NOEXCEPT
      ^~~~~~~~
In file included from StdAfx.h:41:0:
config/build_config.h:99:7: note: from previous declaration 'void operator delete [](void*)'
  void operator delete[](void* p);
       ^~~~~~~~
Makefile:449: recipe for target 'stdafx' failed
mingw32-make: *** [stdafx] Error 1

@m-tmatma
Copy link
Member

http://mergedoc.osdn.jp/Pleiades All in One 4.3.2.v20140321C/C++ 64bit Full Edition
をダウンロードして、以下のようなバッチファイルでビルドしてみました。

set MINGW=C:\pleiades-e4.3-cpp-jre_20140321\pleiades\eclipse\mingw\bin
set PATH=%MINGW%;%PATH%


cd /d %~dp0

pushd sakura_core

@rem mingw32-make githash stdafx Funccode_enum.h Funccode_define.h
mingw32-make clean
mingw32-make MYDEFINES=-D_DEBUG MYCFLAGS="-g -O0" githash stdafx Funccode_enum.h Funccode_define.h
mingw32-make MYDEFINES=-D_DEBUG MYCFLAGS="-g -O0" -j4

popd

以下のようなエラーになりました。

g++ -O2 -finput-charset=utf-8 -fexec-charset=cp932 -I. -DWIN32 -DWINVER=0x500 -D_WIN32_WINNT=0x500 -D_WIN32_IE=0x501 -DMINGW_HAS_SECURE_API=1 -DNOMINMAX -D_UNICODE -DUNICODE -DNDEBUG -g -O0  ../HeaderMake/HeaderMake.cpp -o ../HeaderMake/HeaderMake.exe -static-libgcc
cc1plus.exe: error: no iconv implementation, cannot convert from UTF-8 to cp932
mingw32-make: *** [../HeaderMake/HeaderMake.exe] Error 1

@berryzplus
Copy link
Contributor Author

http://mergedoc.osdn.jp/
4.6 Neon より新しいのを使ってください。
4.5 Mars ではビルドできなかったはずです。 #306 (comment)
提示されたバッチファイル自体は、MinGWのパス以外それでいいと思います。

以下のようなエラーになりました。
g++ -O2 -finput-charset=utf-8 -fexec-charset=cp932 -I. -DWIN32 -DWINVER=0x500 -D_WIN32_WINNT=0x500 -D_WIN32_IE=0x501 -DMINGW_HAS_SECURE_API=1 -DNOMINMAX -D_UNICODE -DUNICODE -DNDEBUG -g -O0 ../HeaderMake/HeaderMake.cpp -o ../HeaderMake/HeaderMake.exe -static-libgcc
cc1plus.exe: error: no iconv implementation, cannot convert from UTF-8 to cp932
mingw32-make: *** [../HeaderMake/HeaderMake.exe] Error 1

これは以前 #306 (comment) で ぼく自身も遭遇したエラーな気がします。これが起きた理由は不明で、最近は発生していません。いずれにしても 4.3 Kepler では 最近導入した noexcept に対応してなくてビルドエラーになるっぽいです。

@m-tmatma
Copy link
Member

4.6.3 だと修正適用前でも後でもコンパイル通ります。

@berryzplus
Copy link
Contributor Author

4.6.3 だと修正適用前でも後でもコンパイル通ります。

バッチファイルを見る限り、やり方が間違ってるとも思えないです。
モジュールの違いで差がでることがあるのかな・・・

http://mergedoc.osdn.jp/
ここにある 4.6 Neon の 64bit C++ Full(jre付)で -D_DEBUG のときだけ下記エラーが出ます。
ダウンロードしたzipの名前で展開しているので違うものを使っていないか見てみてください。

H:/pleiades-4.6.3-cpp-win-64bit-jre_20170422/pleiades/eclipse/mingw/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/new:120:6: error: declaration of 'void operator delete(void*) noexcept' has a different exception specifier
 void operator delete(void*) _GLIBCXX_USE_NOEXCEPT
      ^~~~~~~~

#386 (comment)

@berryzplus
Copy link
Contributor Author

berryzplus commented Sep 23, 2018

これって、なんでマージしないんでしたっけ?

appveyorでも、このPRで対処したいエラーは再現しています。

エラー発生のエビデンス

https://ci.appveyor.com/project/berryzplus/sakura/build/1.0.139/job/3xeoclf0x4buu60c
(エラーが出ていてもビルドは通るようですが。)

エラー解消のエビデンス
~~~https://ci.appveyor.com/project/berryzplus/sakura/build/job/i5ogcim966bbtqi9~~~
https://ci.appveyor.com/project/berryzplus/sakura/build/1.0.140/job/i5ogcim966bbtqi9

(エビデンスのURLが最新ビルドのMinGW Debugを指していたのでURL差し替えしました)

@m-tmatma
Copy link
Member

エラー発生のエビデンス
https://ci.appveyor.com/project/berryzplus/sakura/build/job/3xeoclf0x4buu60c
(エラーが出ていてもビルドは通るようですが。)

https://ci.appveyor.com/project/berryzplus/sakura/build/1.0.144
Configuration: Debug; Platform: MinGW ですか?

発生していないように見えます

@berryzplus
Copy link
Contributor Author

発生していないように見えます

リンクが最新ビルドを指していました。
正しくはこれ。
変更適用前: https://ci.appveyor.com/project/berryzplus/sakura/build/1.0.139/job/3xeoclf0x4buu60c
変更適用後: https://ci.appveyor.com/project/berryzplus/sakura/build/1.0.140/job/i5ogcim966bbtqi9

@m-tmatma
Copy link
Member

https://ci.appveyor.com/project/berryzplus/sakura/build/1.0.139/job/3xeoclf0x4buu60c
で以下エラーを確認しました。

[00:00:04] g++ -finput-charset=utf-8 -fexec-charset=cp932 -I. -DWIN32 -DWINVER=0x500 -D_WIN32_WINNT=0x500 -D_WIN32_IE=0x501 -DNOMINMAX -D_UNICODE -DUNICODE -D_DEBUG -g -O0  -c StdAfx.h
[00:00:06] In file included from C:/mingw-w64/x86_64-7.2.0-posix-seh-rt_v5-rev1/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/ext/new_allocator.h:33:0,
[00:00:06]                  from C:/mingw-w64/x86_64-7.2.0-posix-seh-rt_v5-rev1/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/x86_64-w64-mingw32/bits/c++allocator.h:33,
[00:00:06]                  from C:/mingw-w64/x86_64-7.2.0-posix-seh-rt_v5-rev1/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/bits/allocator.h:46,
[00:00:06]                  from C:/mingw-w64/x86_64-7.2.0-posix-seh-rt_v5-rev1/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/string:41,
[00:00:06]                  from StdAfx.h:64:
[00:00:06] C:/mingw-w64/x86_64-7.2.0-posix-seh-rt_v5-rev1/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/new:124:6: error: declaration of 'void operator delete(void*) noexcept' has a different exception specifier
[00:00:06]  void operator delete(void*) _GLIBCXX_USE_NOEXCEPT
[00:00:06]       ^~~~~~~~
[00:00:06] In file included from StdAfx.h:41:0:
[00:00:06] config/build_config.h:98:7: note: from previous declaration 'void operator delete(void*)'
[00:00:06]   void operator delete(void* p);
[00:00:06]        ^~~~~~~~
[00:00:06] In file included from C:/mingw-w64/x86_64-7.2.0-posix-seh-rt_v5-rev1/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/ext/new_allocator.h:33:0,
[00:00:06]                  from C:/mingw-w64/x86_64-7.2.0-posix-seh-rt_v5-rev1/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/x86_64-w64-mingw32/bits/c++allocator.h:33,
[00:00:06]                  from C:/mingw-w64/x86_64-7.2.0-posix-seh-rt_v5-rev1/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/bits/allocator.h:46,
[00:00:06]                  from C:/mingw-w64/x86_64-7.2.0-posix-seh-rt_v5-rev1/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/string:41,
[00:00:06]                  from StdAfx.h:64:
[00:00:06] C:/mingw-w64/x86_64-7.2.0-posix-seh-rt_v5-rev1/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/new:126:6: error: declaration of 'void operator delete [](void*) noexcept' has a different exception specifier
[00:00:06]  void operator delete[](void*) _GLIBCXX_USE_NOEXCEPT
[00:00:06]       ^~~~~~~~
[00:00:06] In file included from StdAfx.h:41:0:
[00:00:06] config/build_config.h:99:7: note: from previous declaration 'void operator delete [](void*)'
[00:00:06]   void operator delete[](void* p);
[00:00:06]        ^~~~~~~~

@berryzplus
Copy link
Contributor Author

あざっす。マージしちゃいます。

@berryzplus berryzplus merged commit d5d330a into sakura-editor:master Sep 24, 2018
@berryzplus berryzplus deleted the feature/upgrade_delete_signature branch September 24, 2018 08:28
@m-tmatma m-tmatma added this to the next release milestone Oct 21, 2018
HoppingTappy pushed a commit to HoppingTappy/sakura that referenced this pull request Jun 11, 2019
…delete_signature

deleteのオーバーロードがGCCに怒られる対応
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MinGW MinGW
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants