[haiku-bugs] [Haiku] #12244: net_server: warning on delete of address of a reference

  • From: "korli" <trac@xxxxxxxxxxxx>
  • Date: Sun, 26 Jul 2015 14:46:35 -0000

#12244: net_server: warning on delete of address of a reference
--------------------------------+------------------------------
Reporter: korli | Owner: axeld
Type: bug | Status: new
Priority: normal | Milestone: Unscheduled
Component: Servers/net_server | Version: R1/Development
Keywords: | Blocked By:
Blocking: | Has a Patch: 0
Platform: All |
--------------------------------+------------------------------
Newer versions of GCC produces this warning at this [http://cgit.haiku-
os.org/haiku/tree/src/servers/net/Services.cpp#n332 line]

{{{
error: the compiler can assume that the address of 'service' will never be
NULL
}}}

This probably means that the compiler knows that delete checks for NULL
pointers, whereas it also knows that the address of 'service' cannot be
NULL. The delete check might then be pointless.

To fix this, I'd move 'service' to a pointer and adjust all callers.

--
Ticket URL: <https://dev.haiku-os.org/ticket/12244>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: