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 warnings for -Wenum-float-conversion #1284

Merged
merged 1 commit into from Nov 4, 2023

Conversation

ma8ma
Copy link
Collaborator

@ma8ma ma8ma commented Nov 4, 2023

無名列挙型の値がdobule型の変数と算術演算しているとコンパイラーの警告で指摘されたためconstexpr定数に変更して修正します。

clang-17のレポート

src/image/imageadmin.cpp:978:41: warning: compound assignment of floating-point type 'double' from enumeration type '(unnamed enum at ../src/global.h:10:1)' [-Wenum-float-conversion]
  978 |         if( scroll == SCROLL_LEFT ) pos -= ICON_SIZE;
      |                                     ~~~ ^  ~~~~~~~~~
src/image/imageadmin.cpp:979:18: warning: compound assignment of floating-point type 'double' from enumeration type '(unnamed enum at ../src/global.h:10:1)' [-Wenum-float-conversion]
  979 |         else pos += ICON_SIZE;
      |              ~~~ ^  ~~~~~~~~~
src/article/drawareabase.cpp:2305:47: warning: arithmetic between enumeration type '(unnamed enum at /home/ma8ma/var/repos/JDim/weverythingclang17-unity/../src/article/drawareabase.cpp:57:1)' and floating-point type 'double' [-Wenum-float-conversion]
 2305 |     constexpr const double r = AUTOSCR_CIRCLE / 2.0;
      |                                ~~~~~~~~~~~~~~ ^ ~~~

無名列挙型の値がdobule型の変数と算術演算しているとコンパイラーの警告で
指摘されたためconstexpr定数に変更して修正します。

clang-17のレポート
```
src/image/imageadmin.cpp:978:41: warning: compound assignment of floating-point type 'double' from enumeration type '(unnamed enum at ../src/global.h:10:1)' [-Wenum-float-conversion]
  978 |         if( scroll == SCROLL_LEFT ) pos -= ICON_SIZE;
      |                                     ~~~ ^  ~~~~~~~~~
src/image/imageadmin.cpp:979:18: warning: compound assignment of floating-point type 'double' from enumeration type '(unnamed enum at ../src/global.h:10:1)' [-Wenum-float-conversion]
  979 |         else pos += ICON_SIZE;
      |              ~~~ ^  ~~~~~~~~~
src/article/drawareabase.cpp:2305:47: warning: arithmetic between enumeration type '(unnamed enum at /home/ma8ma/var/repos/JDim/weverythingclang17-unity/../src/article/drawareabase.cpp:57:1)' and floating-point type 'double' [-Wenum-float-conversion]
 2305 |     constexpr const double r = AUTOSCR_CIRCLE / 2.0;
      |                                ~~~~~~~~~~~~~~ ^ ~~~
```
@ma8ma ma8ma added the bug バグの追跡 label Nov 4, 2023
@ma8ma ma8ma merged commit c337a04 into master Nov 4, 2023
20 checks passed
@ma8ma ma8ma deleted the fix-compiler-warnings-Wenum-float-conversion branch November 4, 2023 14:43
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.

None yet

1 participant