[PATCH] clean up PROTO macros

Alexey Mahotkin <[email protected]>
Newsgroups gmane.comp.version-control.cvs.bugs
Message-ID <[email protected]>
Get rid of the maze of many PROTO definitions, all subtly different.
Move them all to lib/PROTO.h, and use it everywhere.  Do the master
definition as per Autoconf documentation.

Rename USE_PROTOTYPES symbol to PROTOTYPES, as per Autoconf
documentation.

Remember to actually write ChangeLog entries.


 lib/ChangeLog        |   11 +++++++++++
 lib/Makefile.am      |    1 +
 lib/PROTO.h          |   22 ++++++++++++++++++++++
 lib/getline.h        |   12 ++++--------
 lib/md5.c            |    9 +--------
 lib/savecwd.c        |    2 +-
 lib/savecwd.h        |   14 +++++---------
 lib/sighandle.c      |    9 +--------
 os2/ChangeLog        |    5 +++++
 os2/config.h         |    2 +-
 src/ChangeLog        |    7 +++++++
 src/cvs.h            |    9 +--------
 src/error.h          |   10 +---------
 src/server.c         |    2 +-
 windows-NT/ChangeLog |    5 +++++
 windows-NT/config.h  |    2 +-
 16 files changed, 68 insertions(+), 54 deletions(-)

--- /dev/null	Wed Jan  1 02:48:46 2003
+++ ccvs-alexm/lib/PROTO.h	Sat May 10 21:25:33 2003
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 1992, Brian Berliner and Jeff Polk
+ * Copyright (c) 1989-1992, Brian Berliner
+ *
+ * You may distribute under the terms of the GNU General Public License as
+ * specified in the README file that comes with the CVS kit.
+ *
+ */
+
+#ifndef PROTO_H
+#define PROTO_H
+
+/* Add prototype support as per AC_C_PROTOTYPES documentation.  */
+#ifndef PROTO
+# if PROTOTYPES
+#  define PROTO(ARGS) ARGS
+# else
+#  define PROTO(ARGS) ()
+# endif
+#endif
+
+#endif
--- ccvs/src/error.h~PROTO	Sat May 10 21:10:56 2003
+++ ccvs-alexm/src/error.h	Sat May 10 21:19:09 2003
@@ -14,15 +14,7 @@
 #ifndef ERROR_H
 #define ERROR_H
 
-/* Add prototype support.  Normally this is done in cvs.h, but that
-   doesn't get included from lib/savecwd.c.  */
-#ifndef PROTO
-# if PROTOTYPES
-#   define PROTO(ARGS) ARGS
-# else
-#   define PROTO(ARGS) ()
-# endif
-#endif
+#include "PROTO.h"
 
 /* Add GNU attribute suppport.  */
 #ifndef __attribute__
--- ccvs/src/cvs.h~PROTO	Sat May 10 21:10:59 2003
+++ ccvs-alexm/src/cvs.h	Sat May 10 21:18:38 2003
@@ -24,14 +24,7 @@
 #define	PTR	char *
 #endif
 
-/* Add prototype support.  */
-#ifndef PROTO
-# if PROTOTYPES
-#   define PROTO(ARGS) ARGS
-# else
-#   define PROTO(ARGS) ()
-# endif
-#endif
+#include "PROTO.h"
 
 /* Add GNU attribute suppport.  */
 #ifndef __attribute__
--- ccvs/lib/Makefile.am~PROTO	Sat May 10 21:11:26 2003
+++ ccvs-alexm/lib/Makefile.am	Sat May 10 21:11:48 2003
@@ -49,6 +49,7 @@ libcvs_a_SOURCES = \
 	getpagesize.h \
 	md5.h \
 	regex.h \
+        PROTO.h \
 	savecwd.h \
 	system.h \
 	wait.h \
--- ccvs/lib/savecwd.h~PROTO	Sat May 10 21:12:14 2003
+++ ccvs-alexm/lib/savecwd.h	Sat May 10 21:26:15 2003
@@ -1,20 +1,16 @@
 #ifndef SAVE_CWD_H
 #define SAVE_CWD_H 1
 
+#include "PROTO.h"
+
 struct saved_cwd
   {
     int desc;
     char *name;
   };
 
-#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
-#define __PROTO(args) args
-#else
-#define __PROTO(args) ()
-#endif  /* GCC.  */
-
-int save_cwd __PROTO((struct saved_cwd *cwd));
-int restore_cwd __PROTO((const struct saved_cwd *cwd, const char *dest));
-void free_cwd __PROTO((struct saved_cwd *cwd));
+int save_cwd PROTO((struct saved_cwd *cwd));
+int restore_cwd PROTO((const struct saved_cwd *cwd, const char *dest));
+void free_cwd PROTO((struct saved_cwd *cwd));
 
 #endif /* SAVE_CWD_H */
--- ccvs/os2/config.h~PROTO	Sat May 10 21:16:34 2003
+++ ccvs-alexm/os2/config.h	Sat May 10 21:24:02 2003
@@ -304,7 +304,7 @@ extern pid_t getpid (void);
 #endif
 
 /* We definitely have prototypes.  */
-#define USE_PROTOTYPES 1
+#define PROTOTYPES 1
 
 /* Under OS/2, filenames are case-insensitive, and both / and \
    are path component separators.  */
--- ccvs/windows-NT/config.h~PROTO	Sat May 10 21:16:38 2003
+++ ccvs-alexm/windows-NT/config.h	Sat May 10 21:23:51 2003
@@ -254,7 +254,7 @@ extern int readlink (char *path, char *b
 extern pid_t getpid (void);
 
 /* We definitely have prototypes.  */
-#define USE_PROTOTYPES 1
+#define PROTOTYPES 1
 
 /* This is just a call to the Win32 Sleep function.  */
 unsigned int sleep (unsigned int);
--- ccvs/lib/savecwd.c~PROTO	Sat May 10 21:20:00 2003
+++ ccvs-alexm/lib/savecwd.c	Sat May 10 21:20:04 2003
@@ -35,7 +35,7 @@ extern int errno;
 #include "savecwd.h"
 #include "error.h"
 
-char *xgetwd __PROTO((void));
+char *xgetwd PROTO((void));
 
 /* Record the location of the current working directory in CWD so that
    the program may change to other directories and later use restore_cwd
--- ccvs/lib/sighandle.c~PROTO	Sat May 10 21:23:19 2003
+++ ccvs-alexm/lib/sighandle.c	Sat May 10 21:23:30 2003
@@ -37,14 +37,7 @@
 #include <stdio.h>
 #include <signal.h>
 
-/* Add prototype support.  */
-#ifndef PROTO
-#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
-#define PROTO(ARGS) ARGS
-#else
-#define PROTO(ARGS) ()
-#endif
-#endif
+#include "PROTO.h"
 
 #ifdef STDC_HEADERS
 #include <stdlib.h>
--- ccvs/src/server.c~PROTO	Sat May 10 21:24:26 2003
+++ ccvs-alexm/src/server.c	Sat May 10 21:24:31 2003
@@ -3948,7 +3948,7 @@ server_modtime (finfo, vers_ts)
 
 /* See server.h for description.  */
 
-#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
+#if defined (PROTOTYPES) ? PROTOTYPES : defined (__STDC__)
 /* Need to prototype because mode_t might be smaller than int.  */
 void
 server_updated (
--- ccvs/lib/md5.c~PROTO	Sat May 10 21:24:41 2003
+++ ccvs-alexm/lib/md5.c	Sat May 10 21:24:55 2003
@@ -34,14 +34,7 @@
 
 #include <string.h>	/* for memcpy() and memset() */
 
-/* Add prototype support.  */
-#ifndef PROTO
-#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
-#define PROTO(ARGS) ARGS
-#else
-#define PROTO(ARGS) ()
-#endif
-#endif
+#include "PROTO.h"
 
 #include "md5.h"
 
--- ccvs/src/ChangeLog~PROTO	Sat May 10 21:27:13 2003
+++ ccvs-alexm/src/ChangeLog	Sat May 10 21:31:50 2003
@@ -1,3 +1,10 @@
+2003-05-10  Alexey Mahotkin  <[email protected]>
+
+	* server.c: Use standard PROTOTYPES symbol instead of non-standard
+	USE_PROTOTYPES.
+
+	* error.h, cvs.h: Use PROTO.h.
+
 2003-05-09  Derek Price  <[email protected]>
 
 	* buffer.c: Reindent some compiler directives in order to make nesting
--- ccvs/lib/ChangeLog~PROTO	Sat May 10 21:27:16 2003
+++ ccvs-alexm/lib/ChangeLog	Sat May 10 21:40:30 2003
@@ -1,3 +1,14 @@
+2003-05-10  Alexey Mahotkin  <[email protected]>
+
+	* getline.h, md5.c, sighandle.c, savecwd.h: Use PROTO.h.
+
+	* savecwd.c: Use standard PROTO macro.
+
+	* Makefile.am: Add PROTO.h
+
+	* PROTO.h: PROTO macro definition is finally here, as specified in
+	Autoconf documentation.
+
 2003-04-30  Derek Price  <[email protected]>
 
 	* Makefile.in: Regenerated.
--- ccvs/windows-NT/ChangeLog~PROTO	Sat May 10 21:27:19 2003
+++ ccvs-alexm/windows-NT/ChangeLog	Sat May 10 21:32:26 2003
@@ -1,3 +1,8 @@
+2003-05-10  Alexey Mahotkin  <[email protected]>
+
+	* config.h: Use standard PROTOTYPES symbol instead of non-standard
+	USE_PROTOTYPES.
+
 2003-04-30  Derek Price  <[email protected]>
 
 	* Makefile.in: Regenerated.
--- ccvs/os2/ChangeLog~PROTO	Sat May 10 21:27:23 2003
+++ ccvs-alexm/os2/ChangeLog	Sat May 10 21:32:13 2003
@@ -1,3 +1,8 @@
+2003-05-10  Alexey Mahotkin  <[email protected]>
+
+	* config.h: Use standard PROTOTYPES symbol instead of non-standard
+	USE_PROTOTYPES.
+
 2002-03-21  Derek Price  <[email protected]>
 
 	* Makefile.in: Remove unecessary dependence on $(srcdir) to
--- ccvs/lib/getline.h~PROTO	Sat May 10 21:39:34 2003
+++ ccvs-alexm/lib/getline.h	Sat May 10 21:39:56 2003
@@ -3,21 +3,17 @@
 
 #include <stdio.h>
 
-#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
-#define __PROTO(args) args
-#else
-#define __PROTO(args) ()
-#endif  /* GCC.  */
+#include "PROTO.h"
 
 #define GETLINE_NO_LIMIT -1
 
 int
-  getline __PROTO ((char **_lineptr, size_t *_n, FILE *_stream));
+  getline PROTO ((char **_lineptr, size_t *_n, FILE *_stream));
 int
-  getline_safe __PROTO ((char **_lineptr, size_t *_n, FILE *_stream,
+  getline_safe PROTO ((char **_lineptr, size_t *_n, FILE *_stream,
                          int limit));
 int
-  getstr __PROTO ((char **_lineptr, size_t *_n, FILE *_stream,
+  getstr PROTO ((char **_lineptr, size_t *_n, FILE *_stream,
 		   int _terminator, int _offset, int limit));
 
 #endif /* _getline_h_ */

_


--alexm
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.