Closed Bug 1220544 Opened 9 years ago Closed 9 years ago

Fix -Wunreachable-code warnings in xpcom

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox45 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

Details

Attachments

(1 file)

xpcom/glue/PLDHashTable.cpp:471:10 [-Wunreachable-code-return] 'return' will never be executed
xpcom/tests/TestAutoPtr.cpp:324:9 [-Wunreachable-code] code will never be executed
xpcom/tests/TestBlockingProcess.cpp:6:11 [-Wunreachable-code-return] 'return' will never be executed

Adding extra parens around the always-false conditional in TestAutoPtr.cpp suppresses the -Wunreachable-code warning about the printf never being reached.
Attachment #8681796 - Flags: review?(continuation)
Comment on attachment 8681796 [details] [diff] [review]
Wunreachable-code_xpcom.patch

Review of attachment 8681796 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks for fixing this.

::: xpcom/glue/PLDHashTable.cpp
@@ -467,5 @@
>      }
>    }
> -
> -  // NOTREACHED
> -  return nullptr;

Please leave the comment.

::: xpcom/tests/TestAutoPtr.cpp
@@ +318,5 @@
>      }
>  
>      printf("\nTesting casts and equality tests.\n");
>  
> +    if (((void*)(TestObject*)0x1000 ==

Please add a comment here about why you are adding these extra parens.

::: xpcom/tests/TestBlockingProcess.cpp
@@ -3,4 @@
>  int main()
>  {
>     while(1) PR_Sleep(PR_SecondsToInterval(10));
> -   return 0;

Hopefully this won't cause a warning with some less-smart compiler!
Attachment #8681796 - Flags: review?(continuation) → review+
Thanks! I will make these changes before landing.
https://hg.mozilla.org/mozilla-central/rev/9d35ff5cf796
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
removing the b2g 2.5 flag since this commit has been reverted due to an incorrect merge, sorry for the confusion
Depends on: 1258087
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: