[tor-bugs] #7260 [Tor]: MinGW64 & -Werror -Werror

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Tue Oct 30 05:10:28 UTC 2012


#7260: MinGW64 & -Werror -Werror
--------------------+-------------------------------------------------------
 Reporter:  yayooo  |          Owner:                    
     Type:  defect  |         Status:  needs_revision    
 Priority:  normal  |      Milestone:  Tor: 0.2.3.x-final
Component:  Tor     |        Version:  Tor: 0.2.3.24-rc  
 Keywords:          |         Parent:                    
   Points:          |   Actualpoints:                    
--------------------+-------------------------------------------------------

Comment(by yayooo):

 I am sure each line modification in Werror.patch is for the goal "-Wextra
 -Werror"
 I have test this patch on Linux_x86_64_2.6.18 & MinGW64 &
 OpenBSD_5.1_amd64
 and make sure with "-Wextra -Werror" or without "-Wextra -Werror" almost
 generate same config.log
 and compiled successfully and ran successfully.


 -   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$3],[void *ptr= $1 ;])],
 +   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$3],[void *ptr= $1 ;ptr=ptr;])],
 AVOID:
 error: unused variable 'ptr'


 -int main(int c, char **v) {
 +int main() {
 AVOID:
 error: unused parameter 'c'
 error: unused parameter 'v'


 -AC_SEARCH_LIBS(pow, [m], , AC_MSG_ERROR([Could not find pow in libm or
 libc.]))
 +AC_MSG_CHECKING(for library containing pow)
 +LIBS=''
 +AC_LINK_IFELSE([AC_LANG_PROGRAM(double
 pow(double,double);,pow(2.7,3.1);)],ac_cv_search_pow="none required")
  if test "$ac_cv_search_pow" != "none required"; then
 +LIBS='-lm'
 +AC_LINK_IFELSE([AC_LANG_PROGRAM(double
 pow(double,double);,pow(2.7,3.1);)],ac_cv_search_pow="$LIBS",AC_MSG_RESULT(no)
 +AC_MSG_ERROR(Could not find pow in libm or libc.))
      TOR_LIB_MATH="$ac_cv_search_pow"
 +AC_LINK_IFELSE([AC_LANG_PROGRAM(long int
 lround(double);,lround(2.7);)],AC_DEFINE(HAVE_LROUND,1))
 +AC_LINK_IFELSE([AC_LANG_PROGRAM(double
 rint(double);,rint(2.7);)],AC_DEFINE(HAVE_RINT,1))
  fi
 +AC_MSG_RESULT($ac_cv_search_pow)
 AVOID:
 error: conflicting types for built-in function 'lround'
 error: conflicting types for built-in function 'rint'
 error: conflicting types for built-in function 'pow'



 -    [RAND_add((void*)0,0,0); exit(0);], [],
 +    [RAND_add((void*)0,0,0);], [],
 AVOID:
 error: incompatible implicit declaration of built-in function 'exit'


 +#ifndef _WIN32_WINNT
  #define _WIN32_WINNT 0x0501
 +#endif
 AVOID:
 error: "_WIN32_WINNT" redefined


 -int main(int c, char**v) { if (((time_t)-1)<0) return 1; else return 0;
 }])],
 +int main() { if (((time_t)-1)<1) return 1; else return 0; }])],
 AVOID:
 error: comparison of unsigned expression < 0 is always false


 -               "process %d.",
 -               procmon->pid);
 +               "process "I64_FORMAT".",
 +               I64_PRINTF_ARG(procmon->pid));
 AVOID:
 error: format '%d' expects argument of type 'int', but argument 5 has type
 'pid_t'


 -  log_debug(LD_NET,"Cleaning up connection (fd %d).",conn->s);
 +  log_debug(LD_NET,"Cleaning up connection (fd
 "TOR_SOCKET_T_FORMAT").",conn->s);
 AVOID:
 error: format '%d' expects argument of type 'int', but argument 5 has type
 'intptr_t'


 -launch_test_addresses(int fd, short event, void *args)
 +launch_test_addresses(evutil_socket_t fd, short event, void *args)
 AVOID:
 error: passing argument 4 of 'event_new' from incompatible pointer type


 -       tt_assert_test_type(a,b,#a" "#op" "#b,long,(val1_ op val2_), \
 -           "%ld",TT_EXIT_TEST_FUNCTION)
 +       tt_assert_test_type(a,b,#a" "#op" "#b,INTPTR_T_to_INT,(val1_ op
 val2_), \
 +           ""INTPTR_T_FORMAT"",TT_EXIT_TEST_FUNCTION)
 AVOID:
 error: cast from pointer to integer of different size

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


More information about the tor-bugs mailing list