Your message dated Sun, 26 Jan 2014 20:14:52 +0100
with message-id <2665846.JzY8NL1V66@johansson>
has caused the   report #671141,
regarding libspf2-dev: should support C++ compilation
to be marked as having been forwarded to the upstream software
author(s) spf-de...@listbox.com

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
671141: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=671141
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Just a small request that's been lingering in the Debian bugtracker for a year 
and a half: You might want to add conditional extern "C" { } around the 
declarations in the header files (although not only in spf_request.h as the 
bug report suggests).

http://bugs.debian.org/671141

Technically, wrapping spf.h, including its #include:s of other header files, 
should suffice, since one'll normally #include <spf.h> when using libspf2 (the 
documentation doesn't provide much guidance), but I guess best practice is to 
wrap each header file separately.

I've attached a patch that I hope does this correctly.

-- 
Magnus Holmgren        holmg...@lysator.liu.se
                       holmg...@debian.org
--- a/src/include/spf.h
+++ b/src/include/spf.h
@@ -21,7 +21,6 @@
 #ifndef INC_SPF
 #define INC_SPF
 
-
 #include "spf_lib_version.h"
 
 #include "spf_server.h"
@@ -66,7 +65,9 @@
  * SPF_server_t object. */
 #define SPF_DEFAULT_EXP		  "Please%_see%_http://www.openspf.org/Why?id=%{S}&ip=%{C}&receiver=%{R}";
 
-
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /* ********************************************************************* */
 
@@ -88,4 +89,8 @@ void SPF_get_lib_version( int *major, in
 
 const char *SPF_strrrtype(ns_type rr_type);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
--- a/src/include/spf_dns.h
+++ b/src/include/spf_dns.h
@@ -76,6 +76,10 @@
 #define ns_t_spf	99
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef int SPF_dns_stat_t;
 
 typedef struct SPF_dns_server_struct SPF_dns_server_t;
@@ -148,5 +152,8 @@ SPF_dns_rr_t	*SPF_dns_rlookup6( SPF_dns_
 char		*SPF_dns_get_client_dom(SPF_dns_server_t *spf_dns_server,
 				SPF_request_t *sr);
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif
--- a/src/include/spf_dns_cache.h
+++ b/src/include/spf_dns_cache.h
@@ -19,6 +19,10 @@
 #ifndef INC_SPF_DNS_CACHE
 #define INC_SPF_DNS_CACHE
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 
 /**
  * @file
@@ -118,4 +122,8 @@ void	 SPF_dns_cache_set_ttl( SPF_dns_ser
 void	 SPF_dns_set_conserve_cache( SPF_dns_server_t *spf_dns_server,
 				int conserve_cache );
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
--- a/src/include/spf_dns_null.h
+++ b/src/include/spf_dns_null.h
@@ -30,6 +30,9 @@
  * debugging purposes.
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /*
  * These routines take care of creating/destroying/etc. the objects
@@ -51,5 +54,8 @@
 SPF_dns_server_t	*SPF_dns_null_new( SPF_dns_server_t *layer_below,
 				const char *name, int debug);
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif
--- a/src/include/spf_dns_resolv.h
+++ b/src/include/spf_dns_resolv.h
@@ -19,6 +19,10 @@
 #ifndef INC_SPF_DNS_RESOLV
 #define INC_SPF_DNS_RESOLV
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @file
  * The resolv DNS layer is an interface to the libresolv stub DNS resolver.
@@ -43,4 +47,8 @@
 SPF_dns_server_t	*SPF_dns_resolv_new(SPF_dns_server_t *layer_below,
 				const char *name, int debug);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
--- a/src/include/spf_dns_rr.h
+++ b/src/include/spf_dns_rr.h
@@ -21,6 +21,10 @@
 
 #include "spf_dns.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * Data from a DNS RR.
  *
@@ -83,5 +87,8 @@ SPF_errcode_t	 SPF_dns_rr_buf_realloc(SP
 						int idx, size_t len );
 SPF_errcode_t	 SPF_dns_rr_dup(SPF_dns_rr_t **dstp, SPF_dns_rr_t *src);
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif
--- a/src/include/spf_dns_test.h
+++ b/src/include/spf_dns_test.h
@@ -21,6 +21,10 @@
 
 #include "spf_dns.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @file
  * @brief A testing layer for DNS.
@@ -46,4 +50,8 @@
 SPF_dns_server_t	*SPF_dns_test_new( SPF_dns_server_t *layer_below,
 				const char *name, int debug);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
--- a/src/include/spf_log.h
+++ b/src/include/spf_log.h
@@ -36,6 +36,9 @@
 
 #include <stdarg.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 #define SPF_error(errmsg) SPF_errorx( __FILE__, __LINE__, "%s", errmsg )
 void SPF_errorx( const char *file, int line, const char *format, ... ) __attribute__ ((noreturn)) __attribute__ ((format (printf, 3, 4)));
@@ -119,6 +122,8 @@ extern void (*SPF_debug_handler)( const
 	do { if ((x) == NULL) SPF_error(#x " is NULL"); } while(0)
 
 
-
+#ifdef __cplusplus
+}
+#endif
 
 #endif
--- a/src/include/spf_record.h
+++ b/src/include/spf_record.h
@@ -223,6 +223,9 @@ struct SPF_macro_struct
     /** data: (SPF_data_t[] = char[macro_len]) follows */
 };
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /** In spf_record.c */
 SPF_record_t	*SPF_record_new(SPF_server_t *spf_server,
@@ -268,4 +271,8 @@ SPF_errcode_t	 SPF_record_print(SPF_reco
 SPF_errcode_t	 SPF_record_stringify(SPF_record_t *spf_record,
 			char **bufp, size_t *buflenp);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
--- a/src/include/spf_request.h
+++ b/src/include/spf_request.h
@@ -20,6 +20,10 @@ typedef struct SPF_request_struct SPF_re
 
 #include "spf_server.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct SPF_request_struct {
 	/* Structure variables */
 	SPF_server_t	*spf_server;	/* The server. */
@@ -92,5 +96,8 @@ SPF_errcode_t	 SPF_i_done(SPF_response_t
 						SPF_result_t result, SPF_reason_t reason,
 						SPF_errcode_t err);
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif
--- a/src/include/spf_response.h
+++ b/src/include/spf_response.h
@@ -74,6 +74,9 @@
  * note: SPF_RESULT_* values are constrained by the internal PREFIX_* values
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 typedef
 enum SPF_result_enum {
@@ -192,7 +195,6 @@ struct SPF_response_struct {
 	int				 num_dns_mech;
 };
 
-
 SPF_response_t	*SPF_response_new(SPF_request_t *spf_request);
 void			 SPF_response_free(SPF_response_t *rp);
 SPF_response_t	*SPF_response_combine(SPF_response_t *main,
@@ -246,4 +248,8 @@ SPF_errcode_t	 SPF_response_add_warn(SPF
 					SPF_errcode_t code,
 					const char *format, ...);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
--- a/src/include/spf_server.h
+++ b/src/include/spf_server.h
@@ -21,6 +21,10 @@ typedef struct SPF_server_struct SPF_ser
 #include "spf_record.h"
 #include "spf_dns.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifndef SPF_MAX_DNS_MECH
 /* It is a bad idea to change this for two reasons.
  *
@@ -104,4 +108,8 @@ SPF_DECL_ACCESS_INT(max_dns_mech);
 SPF_DECL_ACCESS_INT(max_dns_ptr);
 SPF_DECL_ACCESS_INT(max_dns_mx);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif

Attachment: signature.asc
Description: This is a digitally signed message part.


--- End Message ---

Reply via email to