FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

MAINT: f2py: don't generate code that triggers ``-Wsometimes-uninitialized``. by charris · Pull Request #20982 · numpy/numpy · GitHub

/ numpy Public

MAINT: f2py: don't generate code that triggers -Wsometimes-uninitialized. - #20982

Merged
charris merged 1 commit into
numpy:maintenance/1.22.xfrom
charris:backport-20940
Feb 3, 2022
Merged

charris merged 1 commit into
numpy:maintenance/1.22.xfrom
charris:backport-20940

Conversation

charris commented Feb 2, 2022
edited
Loading

Copy link
Copy Markdown
Member

Backport of #20940.

  • MAINT: f2py: don't generate code that triggers -Wsometimes-uninitialized

Warnings look like:

scipy/linalg/_flapackmodule.c:2200:9: warning: variable 'return_value' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
    if (capi_j>capi_i)
        ^~~~~~~~~~~~~
scipy/linalg/_flapackmodule.c:2217:12: note: uninitialized use occurs here
    return return_value;
           ^~~~~~~~~~~~
scipy/linalg/_flapackmodule.c:2200:5: note: remove the 'if' if its condition is always true
    if (capi_j>capi_i)
    ^~~~~~~~~~~~~~~~~~
scipy/linalg/_flapackmodule.c:2099:21: note: initialize the variable 'return_value' to silence this warning
    int return_value;
                    ^
                     = 0

Also:

  • Initialize complex return value.
  • Warn on non-void callback returning None.
  • Use brackets in if-else block.

This makes the code more readable.

Co-authored-by: Pearu Peterson pearu.peterson@gmail.com

…ized` (numpy#20940)

* MAINT: f2py: don't  generate code that triggers `-Wsometimes-uninitialized`

Warnings look like:

```
scipy/linalg/_flapackmodule.c:2200:9: warning: variable 'return_value' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
    if (capi_j>capi_i)
        ^~~~~~~~~~~~~
scipy/linalg/_flapackmodule.c:2217:12: note: uninitialized use occurs here
    return return_value;
           ^~~~~~~~~~~~
scipy/linalg/_flapackmodule.c:2200:5: note: remove the 'if' if its condition is always true
    if (capi_j>capi_i)
    ^~~~~~~~~~~~~~~~~~
scipy/linalg/_flapackmodule.c:2099:21: note: initialize the variable 'return_value' to silence this warning
    int return_value;
                    ^
                     = 0
```

Also:

- Initialize complex return value.
- Warn on non-void callback returning None.
- Use brackets in if-else block.

This makes the code more readable.

Co-authored-by: Pearu Peterson <pearu.peterson@gmail.com>
charris added this to the 1.22.2 release milestone Feb 2, 2022
charris added 08 - Backport Used to tag backport PRs and removed 08 - Backport Used to tag backport PRs labels Feb 2, 2022
charris merged commit a6b059b into numpy:maintenance/1.22.x Feb 3, 2022
charris deleted the backport-20940 branch April 10, 2022 19:52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL