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

Fix compiler warning for null possibility #551

Merged

Conversation

ma8ma
Copy link
Collaborator

@ma8ma ma8ma commented Dec 28, 2020

Fixes #506

コンパイラ(gcc11)が警告したnullの可能性がある箇所を修正します。

gcc11のログ

menubutton.cpp:126:115: warning: 'this' pointer null [-Wnonnull]
  126 |             dynamic_cast< Gtk::Label* >( item->get_child() )->set_text( MISC::cut_str( items[ i ], MENU_MAX_LNG ) );
      |                                                                                                                   ^
drawareabase.cpp:5405:83: warning: 'this' pointer null [-Wnonnull]
 5405 |     return dynamic_cast< DrawAreaBase* >( widget )->deceleration_tick_impl( clock );
      |                                                                                   ^

コンパイラ(gcc11)が警告したnullの可能性がある箇所を修正します。

gcc11のログ
```
menubutton.cpp:126:115: warning: 'this' pointer null [-Wnonnull]
  126 |             dynamic_cast< Gtk::Label* >( item->get_child() )->set_text( MISC::cut_str( items[ i ], MENU_MAX_LNG ) );
      |                                                                                                                   ^
drawareabase.cpp:5405:83: warning: 'this' pointer null [-Wnonnull]
 5405 |     return dynamic_cast< DrawAreaBase* >( widget )->deceleration_tick_impl( clock );
      |                                                                                   ^
```
@ma8ma ma8ma added the bug バグの追跡 label Dec 28, 2020
@ma8ma ma8ma requested a review from mtasaka December 28, 2020 13:06
@ma8ma ma8ma added this to In progress in State of JDim-v0.4.0+ via automation Dec 28, 2020
Copy link
Collaborator

@mtasaka mtasaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

警告がでないことを確認しました。内容も確認しましたが、いいと思います。

@ma8ma ma8ma merged commit e931355 into JDimproved:master Dec 29, 2020
State of JDim-v0.4.0+ automation moved this from In progress to Done Dec 29, 2020
@ma8ma ma8ma deleted the fix-compiler-warning-for-null-possibility branch December 29, 2020 12:15
@ma8ma
Copy link
Collaborator Author

ma8ma commented Dec 29, 2020

確認ありがとうございます 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug バグの追跡
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

gcc11の警告: dynamic_castについて
2 participants