public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/107730] New: Trivial -Wreturn-type false positive when function marked static
@ 2022-11-17  2:06 sam at gentoo dot org
  2022-11-17  2:07 ` [Bug c/107730] " sam at gentoo dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: sam at gentoo dot org @ 2022-11-17  2:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107730

            Bug ID: 107730
           Summary: Trivial -Wreturn-type false positive when function
                    marked static
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sam at gentoo dot org
  Target Milestone: ---

Created attachment 53915
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53915&action=edit
foo.i

```
#include <unistd.h>

static void *poll_logfiles(int n) {
        for (;;) {
                sleep(1);
        }
}

int main() {
        poll_logfiles(0);
}
```

```
$ gcc-9.5.0 /tmp/foo.c -Wreturn-type
/tmp/foo.c: In function 'poll_logfiles':
/tmp/foo.c:7:1: warning: no return statement in function returning non-void
[-Wreturn-type]
    7 | }
      | ^

# 10.4.1_p20221110
$ gcc-10 /tmp/foo.c -Wreturn-type
/tmp/foo.c: In function 'poll_logfiles':
/tmp/foo.c:7:1: warning: no return statement in function returning non-void
[-Wreturn-type]
    7 | }
      | ^

# 11.3.1_p20221111
$ gcc-11 /tmp/foo.c -Wreturn-type
/tmp/foo.c: In function 'poll_logfiles':
/tmp/foo.c:7:1: warning: no return statement in function returning non-void
[-Wreturn-type]
    7 | }
      | ^

# 12.2.1_p20221112
$ gcc-12 /tmp/foo.c -Wreturn-type
/tmp/foo.c: In function ‘poll_logfiles’:
/tmp/foo.c:7:1: warning: no return statement in function returning non-void
[-Wreturn-type]
    7 | }
      | ^

# 13.0.0_pre20221113
$ gcc-13 /tmp/foo.c -Wreturn-type
/tmp/foo.c: In function 'poll_logfiles':
/tmp/foo.c:7:1: warning: no return statement in function returning non-void
[-Wreturn-type]
    7 | }
      | ^
```

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/107730] Trivial -Wreturn-type false positive when function marked static
  2022-11-17  2:06 [Bug c/107730] New: Trivial -Wreturn-type false positive when function marked static sam at gentoo dot org
@ 2022-11-17  2:07 ` sam at gentoo dot org
  2022-11-17  2:10 ` sam at gentoo dot org
  2022-11-17  2:27 ` sam at gentoo dot org
  2 siblings, 0 replies; 4+ messages in thread
From: sam at gentoo dot org @ 2022-11-17  2:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107730

--- Comment #1 from Sam James <sam at gentoo dot org> ---
Note that if I drop 'static', the warning goes away. Clang does not warn at
all.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/107730] Trivial -Wreturn-type false positive when function marked static
  2022-11-17  2:06 [Bug c/107730] New: Trivial -Wreturn-type false positive when function marked static sam at gentoo dot org
  2022-11-17  2:07 ` [Bug c/107730] " sam at gentoo dot org
@ 2022-11-17  2:10 ` sam at gentoo dot org
  2022-11-17  2:27 ` sam at gentoo dot org
  2 siblings, 0 replies; 4+ messages in thread
From: sam at gentoo dot org @ 2022-11-17  2:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107730

Sam James <sam at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Sam James <sam at gentoo dot org> ---
oh, duh, I'd missed the *.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/107730] Trivial -Wreturn-type false positive when function marked static
  2022-11-17  2:06 [Bug c/107730] New: Trivial -Wreturn-type false positive when function marked static sam at gentoo dot org
  2022-11-17  2:07 ` [Bug c/107730] " sam at gentoo dot org
  2022-11-17  2:10 ` sam at gentoo dot org
@ 2022-11-17  2:27 ` sam at gentoo dot org
  2 siblings, 0 replies; 4+ messages in thread
From: sam at gentoo dot org @ 2022-11-17  2:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107730

Sam James <sam at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |CLOSED

--- Comment #3 from Sam James <sam at gentoo dot org> ---
hm, wait, sorry. It should still emit the warning even without static? Or am I
missing something?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-17  2:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-17  2:06 [Bug c/107730] New: Trivial -Wreturn-type false positive when function marked static sam at gentoo dot org
2022-11-17  2:07 ` [Bug c/107730] " sam at gentoo dot org
2022-11-17  2:10 ` sam at gentoo dot org
2022-11-17  2:27 ` sam at gentoo dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).