[tor-bugs] #2696 [Tor Relay]: Tor doesn't compile under LLVM/clang with --enable-gcc-warnings

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Wed Mar 9 23:43:24 UTC 2011


#2696: Tor doesn't compile under LLVM/clang with --enable-gcc-warnings
-----------------------+----------------------------------------------------
 Reporter:  sjmurdoch  |          Owner:     
     Type:  defect     |         Status:  new
 Priority:  minor      |      Milestone:     
Component:  Tor Relay  |        Version:     
 Keywords:             |         Parent:     
   Points:             |   Actualpoints:     
-----------------------+----------------------------------------------------
 A Tor default build builds cleanly under LLVM/clang (since bug #2689 was
 fixed). However, it does not build cleanly with --enable-gcc-warnings set
 during ./configure. This is for two reasons:

 1) configure sets CFLAGS to include -Wnormalized=id -Woverride-init, which
 do not exist in clang 2.9

 2) -Wshorten-64-to-32 is set, which triggers a warning in geoip.c

  geoip.c:437:33: warning: implicit conversion loses integer precision:
 'long' to 'unsigned int' [-Wshorten-64-to-32]
     ent->last_seen_in_minutes = now / 60;
  geoip.c:441:33: warning: implicit conversion loses integer precision:
 'long' to 'unsigned int' [-Wshorten-64-to-32]
     ent->last_seen_in_minutes = now / 60;

 I've attached a patch which fixes (1). If clang is being used, and the
 version is <= 2.9, -Wnormalized=id -Woverride-init are not set. This logic
 is so that if later versions of clang support these options, we won't
 disable them for all time without noticing.

 I'm not sure if (2) is considered a bug or not. I suppose it will do the
 wrong thing when time_t is negative, but that was a long time ago.

 This is using Tor from Git master (26009a3) on MacOS X 10.6.6.

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/2696>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list