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

mail/smtpfeed with gcc-4 (static func ptr in struct)



>                                           千葉市中央区長洲
>                                                    藤原 誠
こんにちは。
mail/smtpfeed ですが、多分 gcc-4 になったせいか、
struct の中にある static な関数ポインタが嫌われているような気が
します。

  自分の知識では、添付のように static を消すという方法で、無理
矢理通してしまうことしか思い着かなかったのですが、本来はどうす
るのが正しいのでしょうか。

===> Building for smtpfeed-1.18nb1
cc -DINET6 -O2 -I/usr/include  -c address.c
In file included from address.c:42:
extern.h:75: warning: conflicting types for built-in function 'log'
cc -DINET6 -O2 -I/usr/include  -c dns.c
In file included from dns.c:42:
extern.h:75: warning: conflicting types for built-in function 'log'
dns.c: In function 'pregetmx':
dns.c:90: error: invalid storage class for function 'query_domain'
dns.c:90: error: invalid storage class for function 'process_query'
dns.c: At top level:
dns.c:352: error: static declaration of 'query_domain' follows non-static declaration
dns.c:128: error: previous implicit declaration of 'query_domain' was here


--- dns.c-orig	2002-03-15 11:03:39.000000000 +0900
+++ dns.c	2006-07-18 08:38:07.000000000 +0900
@@ -34,6 +34,8 @@
  * SUCH DAMAGE.
  */
 
+#define STATIC    // used to be static string for func pointer
+
 #ifndef lint
 static char *_id_ = "$Id: dns.c,v 1.84 2002/03/15 02:03:20 motonori Exp $";
 #endif
@@ -87,7 +89,7 @@
 	char **map_arg;
 	long stime, etime;
 	int n;
-	static int query_domain(), process_query();
+	STATIC int query_domain(), process_query();
 #ifdef INET6
 	SockAddr dsin;	/* dummy */
 #endif
@@ -347,13 +349,13 @@
 	return 0;
 }
 
-static int
+STATIC int
 query_domain(name, type)
 char *name;
 int type;
 {
 	struct dns_stat *qrp, **hashp;
-	static int make_query();
+	STATIC int make_query();
 
 	qrp = hash_query_lookup(name, &hashp);
 	if (qrp == NULL) {
@@ -387,7 +389,7 @@
 static struct query_chain *RevQueryChain = NULL;
 static query_chain_count = 0;
 
-static int
+STATIC int
 make_query(qrp, type)
 struct dns_stat *qrp;
 int type;
@@ -396,7 +398,7 @@
 	u_char buf[MAXPACKET];
 	int n;
 	struct query_chain *qchain;
-	static int process_query();
+	STATIC int process_query();
 
 	switch (type) {
 	  case T_MX:
@@ -561,7 +563,7 @@
 # define CHECK_SRVR_ADDR	1
 #endif
 
-static int
+STATIC int
 process_query(sync)
 int sync;
 {
@@ -591,8 +593,8 @@
 	char nbuf[MAXDNAME+1];
 	struct dns_stat *qrp;
 	int pending;
-	static void got_answer();
-	static void remove_query();
+	STATIC void got_answer();
+	STATIC void remove_query();
 
 	if (sync == 0 && cnf.cquery_max != 0
 	 && query_chain_count >= cnf.cquery_max)
@@ -1014,7 +1016,7 @@
 	return (0);
 }
 
-static void
+STATIC void
 remove_query(qcp)
 struct query_chain *qcp;
 {
@@ -1047,7 +1049,7 @@
 #endif
 }
 
-static void
+STATIC void
 got_answer(qcp, answer, anssiz)
 struct query_chain *qcp;
 u_char *answer;
@@ -1763,7 +1765,7 @@
 #endif
 					{
 						struct mx *gwmxp;
-						static struct mx* newmx();
+						STATIC struct mx* newmx();
 
 						if (cnf.debug & DEBUG_DNS)
 						log(LOG_DEBUG, "setting protocol gateway as first MX");
@@ -1833,7 +1835,7 @@
 	}
 }
 
-static struct mx*
+STATIC struct mx*
 newmx(name, pref, weight, dp, opt)
 char *name;
 int pref, weight;


---
(藤原)