Bug 145128

Summary: Fix the libusrsctp build with clang
Product: WebKit Reporter: Csaba Osztrogonác <ossy>
Component: New BugsAssignee: Csaba Osztrogonác <ossy>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, ossy
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 145121    
Attachments:
Description Flags
Patch
none
Patch none

Description Csaba Osztrogonác 2015-05-18 04:47:47 PDT
libusrsctp isn't buildable with clang:

netinet/sctp_timer.c:685:46: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
    if (((&stcb->asoc.send_queue)->tqh_first == ((void*)0))) {
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~

netinet/sctp_timer.c:1167:50: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
 if (((&stcb->asoc.asconf_send_queue)->tqh_first == ((void*)0))) {
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~

netinet/sctp_input.c:3421:45: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
   if (((&stcb->asoc.send_queue)->tqh_first == ((void*)0))) {
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~

netinet/sctp_input.c:3625:51: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
 if (((&stcb->asoc.control_send_queue)->tqh_first == ((void*)0))) {
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~

netinet/sctp_input.c:4193:48: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
 { if (((&(stcb)->asoc.free_chunks)->tqh_first == ((void*)0))) { (chk) = (struct sctp_tmit_chunk *)malloc(system_base_info.sctppcbinfo.ipi_zone_chunk);; if ((chk)) { do { (void) __sync_fetch_and_add(&system_base_info.sctppcbinfo.ipi_count_chunk, 1); } while (0); (chk)->whoTo = ((void*)0); (chk)->holds_key_ref = 0; } } else { (chk) = ((&(stcb)->asoc.free_chunks)->tqh_first); do { if ((((chk))->sctp_next.tqe_next) != ((void*)0)) ((chk))->sctp_next.tqe_next->sctp_next.tqe_prev = ((chk))->sctp_next.tqe_prev; else (&(stcb)->asoc.free_chunks)->tqh_last = ((chk))->sctp_next.tqe_prev; *((chk))->sctp_next.tqe_prev = ((chk))->sctp_next.tqe_next; } while ( 0); (void) __sync_fetch_and_sub(&system_base_info.sctppcbinfo.ipi_free_chunks, 1); (chk)->holds_key_ref = 0; (void) __sync_fetch_and_add(&system_base_info.sctpstat.sctps_cached_chk, 1); (stcb)->asoc.free_chunk_cnt--; } };
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~

...

Of course these errors should be fixed in upstream, but we should disable
parentheses-equality for this jhbuild module until the proper fix.
Comment 1 Csaba Osztrogonác 2015-06-10 01:30:56 PDT
I disabled this warning on the github repository:
https://github.com/ossy-szeged/sctp-refimpl/commit/05b66a4f9b09fa841128073e1a248918d11118d3

Let's bump to this new tag.
Comment 2 Csaba Osztrogonác 2015-06-10 01:31:33 PDT
Created attachment 254635 [details]
Patch
Comment 3 Csaba Osztrogonác 2015-06-10 01:51:35 PDT
Comment on attachment 254635 [details]
Patch

removing r?, unfortunately this change isn't enough.
Comment 4 Csaba Osztrogonác 2015-06-10 02:02:55 PDT
(In reply to comment #3)
> Comment on attachment 254635 [details]
> Patch
> 
> removing r?, unfortunately this change isn't enough.

netinet/sctp_output.c:4411:9: error: explicitly assigning value of variable of type 'struct mbuf *' to itself [-Werror,-Wself-assign]
   o_pak=o_pak;
   ~~~~~^~~~~~
netinet/sctp_output.c:11638:9: error: explicitly assigning value of variable of type 'struct mbuf *' to itself [-Werror,-Wself-assign]
   o_pak=o_pak;
   ~~~~~^~~~~~

sctp_os_userspace.h: #define SCTP_ENABLE_UDP_CSUM(m) m=m

This self assignment is ridiculous and doesn't add anything
to the project, only a build failure. I'll remove it.
Comment 5 Csaba Osztrogonác 2015-06-10 02:17:04 PDT
I removed this useless self assignment:
https://github.com/ossy-szeged/sctp-refimpl/commit/acac8578ee2d9c509a7c00e422886bf12afb3968
Comment 6 Csaba Osztrogonác 2015-06-10 02:21:50 PDT
Created attachment 254640 [details]
Patch
Comment 7 Gyuyoung Kim 2015-06-10 17:45:18 PDT
Comment on attachment 254640 [details]
Patch

rs=me
Comment 8 WebKit Commit Bot 2015-06-12 03:03:42 PDT
Comment on attachment 254640 [details]
Patch

Clearing flags on attachment: 254640

Committed r185494: <http://trac.webkit.org/changeset/185494>
Comment 9 WebKit Commit Bot 2015-06-12 03:03:47 PDT
All reviewed patches have been landed.  Closing bug.