bug-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Windows Build: feature branch, src/exithandle.c,


From: Conrad T. Pino
Subject: RE: Windows Build: feature branch, src/exithandle.c,
Date: Sat, 15 May 2004 12:48:16 -0700

Hi Larry,

> From: Larry Jones
> 
> Conrad T. Pino writes:
> > 
> > Line 47:    signals_register (handler);
> > ccvs 1.12\src\exithandle.c(47) : warning C4028: formal parameter 1 
> > different from declaration
> > ccvs 1.12\src\exithandle.c(47) : warning C4024: 'signals_register' : 
> > different types for formal and actual parameter 1
> > 
> > Is this a warning that should be fixed and is anybody working on it?
> 
> Yes, this is a real error that could potentially cause a failure,
> although I believe it works on all currently known platforms.  The
> problem is that we're trying to use the same functions both as signal
> handlers and exit handlers, but signal handlers take one argument and
> exit handlers take no arguments.  As far as I know, no one is working on
> fixing it.

I'd like your comments on the following patch which silences the
warning using a new typedef cast.

> -Larry Jones

Conrad

Index: src/cvs.h
===================================================================
RCS file: /cvs/ccvs/src/cvs.h,v
retrieving revision 1.292
diff -u -p -r1.292 cvs.h
--- src/cvs.h   9 May 2004 04:01:20 -0000       1.292
+++ src/cvs.h   15 May 2004 19:37:59 -0000
@@ -606,8 +606,11 @@ int cvs_casecmp (const char *, const cha
 #endif
 
 /* exithandle.c */
-void signals_register (RETSIGTYPE (*handler)(int));
-void cleanup_register (void (*handler) (void));
+typedef RETSIGTYPE (*signals_handler_t) (int);
+typedef void (*cleanup_handler_t) (void);
+
+void signals_register (signals_handler_t handler);
+void cleanup_register (cleanup_handler_t handler);
 
 void strip_trailing_slashes (char *path);
 void update_delproc (Node * p);

Index: src/exithandle.c
===================================================================
RCS file: /cvs/ccvs/src/exithandle.c,v
retrieving revision 1.1
diff -u -p -r1.1 exithandle.c
--- src/exithandle.c    5 Oct 2003 03:32:45 -0000       1.1
+++ src/exithandle.c    15 May 2004 19:37:59 -0000
@@ -14,7 +14,7 @@
  * Register a handler for all signals.
  */
 void
-signals_register (RETSIGTYPE (*handler)(int))
+signals_register (signals_handler_t handler)
 {
 #ifndef DONT_USE_SIGNALS
 #ifdef SIGABRT
@@ -42,8 +42,8 @@ signals_register (RETSIGTYPE (*handler)(
  * Register a handler for all signals and exit.
  */
 void
-cleanup_register (void (*handler) (void))
+cleanup_register (cleanup_handler_t handler)
 {
-    signals_register (handler);
+    signals_register ((signals_handler_t) handler);
     atexit (handler);
 }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]