public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/39511]  New: Bad warning, with return type, switch and enum
@ 2009-03-20  5:41 alpha dot super-one at laposte dot net
  2009-04-16 20:39 ` [Bug c++/39511] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: alpha dot super-one at laposte dot net @ 2009-03-20  5:41 UTC (permalink / raw)
  To: gcc-bugs

I have:
main.cpp: In function 'QString parityToString(ParityType)':
main.cpp:312: warning: control reaches end of non-void function
When:
enum ParityType 
{
    PAR_NONE,
    PAR_ODD,
    PAR_EVEN,
    PAR_MARK,               //WINDOWS ONLY
    PAR_SPACE
};
And my function:
QString parityToString(ParityType value)
{
        switch(value)
        {
                case PAR_NONE:
                        return "none";
                case PAR_ODD:
                        return "odd";
                case PAR_EVEN:
                        return "even";
                case PAR_MARK:
                        return "mark";
                case PAR_SPACE:
                        return "space";
        }
}


-- 
           Summary: Bad warning, with return type, switch and enum
           Product: gcc
           Version: 4.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: alpha dot super-one at laposte dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39511


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

* [Bug c++/39511] Bad warning, with return type, switch and enum
  2009-03-20  5:41 [Bug c++/39511] New: Bad warning, with return type, switch and enum alpha dot super-one at laposte dot net
@ 2009-04-16 20:39 ` pinskia at gcc dot gnu dot org
  2009-04-17  4:51 ` alpha dot super-one at laposte dot net
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-04-16 20:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2009-04-16 20:39 -------
Can you provide a preprocessed testcase?


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39511


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

* [Bug c++/39511] Bad warning, with return type, switch and enum
  2009-03-20  5:41 [Bug c++/39511] New: Bad warning, with return type, switch and enum alpha dot super-one at laposte dot net
  2009-04-16 20:39 ` [Bug c++/39511] " pinskia at gcc dot gnu dot org
@ 2009-04-17  4:51 ` alpha dot super-one at laposte dot net
  2009-04-17  4:55 ` pinskia at gcc dot gnu dot org
  2009-04-17  5:06 ` alpha dot super-one at laposte dot net
  3 siblings, 0 replies; 6+ messages in thread
From: alpha dot super-one at laposte dot net @ 2009-04-17  4:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from alpha dot super-one at laposte dot net  2009-04-17 04:51 -------
My test case:

enum ParityType 
{
    PAR_NONE,
    PAR_ODD,
    PAR_EVEN,
    PAR_MARK,               //WINDOWS ONLY
    PAR_SPACE
};
QString parityToString(ParityType value)
{
        switch(value)
        {
                case PAR_NONE:
                        return "none";
                case PAR_ODD:
                        return "odd";
                case PAR_EVEN:
                        return "even";
                case PAR_MARK:
                        return "mark";
                case PAR_SPACE:
                        return "space";
        }
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39511


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

* [Bug c++/39511] Bad warning, with return type, switch and enum
  2009-03-20  5:41 [Bug c++/39511] New: Bad warning, with return type, switch and enum alpha dot super-one at laposte dot net
  2009-04-16 20:39 ` [Bug c++/39511] " pinskia at gcc dot gnu dot org
  2009-04-17  4:51 ` alpha dot super-one at laposte dot net
@ 2009-04-17  4:55 ` pinskia at gcc dot gnu dot org
  2009-04-17  5:06 ` alpha dot super-one at laposte dot net
  3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-04-17  4:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2009-04-17 04:54 -------
(In reply to comment #2)
> My test case:

That testcase is not compilable at all.  Can you use -save-temps and provide
the preprocessed source (which is the .ii file that is generated)?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39511


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

* [Bug c++/39511] Bad warning, with return type, switch and enum
  2009-03-20  5:41 [Bug c++/39511] New: Bad warning, with return type, switch and enum alpha dot super-one at laposte dot net
                   ` (2 preceding siblings ...)
  2009-04-17  4:55 ` pinskia at gcc dot gnu dot org
@ 2009-04-17  5:06 ` alpha dot super-one at laposte dot net
  3 siblings, 0 replies; 6+ messages in thread
From: alpha dot super-one at laposte dot net @ 2009-04-17  5:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from alpha dot super-one at laposte dot net  2009-04-17 05:05 -------
My .ii:
http://files.first-world.info/temp/main.ii


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39511


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

* [Bug c++/39511] Bad warning, with return type, switch and enum
       [not found] <bug-39511-4@http.gcc.gnu.org/bugzilla/>
@ 2010-12-19 18:55 ` redi at gcc dot gnu.org
  0 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2010-12-19 18:55 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39511

Jonathan Wakely <redi at gcc dot gnu.org> changed:

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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-12-19 18:55:30 UTC ---
The URL for preprocessed source gives a 404 now.

The enum has a range 0-7 and if you call parityToString(ParityType(5)) then
control falls off the end of the function, so the warning is correct.


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

end of thread, other threads:[~2010-12-19 18:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-20  5:41 [Bug c++/39511] New: Bad warning, with return type, switch and enum alpha dot super-one at laposte dot net
2009-04-16 20:39 ` [Bug c++/39511] " pinskia at gcc dot gnu dot org
2009-04-17  4:51 ` alpha dot super-one at laposte dot net
2009-04-17  4:55 ` pinskia at gcc dot gnu dot org
2009-04-17  5:06 ` alpha dot super-one at laposte dot net
     [not found] <bug-39511-4@http.gcc.gnu.org/bugzilla/>
2010-12-19 18:55 ` redi at gcc dot gnu.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).