git: a46fb43e0e75 - main - math/readstat: fix build on 14-CURRENT

From: Adriaan de Groot <adridg_at_FreeBSD.org>
Date: Sun, 19 Feb 2023 13:07:54 UTC
The branch main has been updated by adridg:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a46fb43e0e75b4099d7ea35b7072a3c2ca9362b1

commit a46fb43e0e75b4099d7ea35b7072a3c2ca9362b1
Author:     Adriaan de Groot <adridg@FreeBSD.org>
AuthorDate: 2023-02-19 13:02:54 +0000
Commit:     Adriaan de Groot <adridg@FreeBSD.org>
CommitDate: 2023-02-19 13:07:52 +0000

    math/readstat: fix build on 14-CURRENT
    
    In 14-CURRENT, the system compiler is more strict; it looks like
    
      In file included from src/readstat_bits.c:9:
        src/readstat_bits.h:10:29: error: a function declaration without
        a prototype is deprecated in all versions of C
        [-Werror,-Wstrict-prototypes]
      int machine_is_little_endian();
    
    Apply the stricter flags in all builds, then fix the source so
    that the prototypes are explicitly (void) -- this is a subtlely
    of C semantics where (void) means "no arguments" and () means
    "arguments unspecified" that rarely matters. Except now.
---
 math/readstat/Makefile                             |  3 +++
 math/readstat/files/patch-src_readstat__bits.h     | 11 +++++++++++
 math/readstat/files/patch-src_readstat__variable.c | 11 +++++++++++
 math/readstat/files/patch-src_sas_ieee.c           | 11 +++++++++++
 math/readstat/files/patch-src_spss_readstat__por.h | 11 +++++++++++
 5 files changed, 47 insertions(+)

diff --git a/math/readstat/Makefile b/math/readstat/Makefile
index b42ad343b6a1..ed2be537b797 100644
--- a/math/readstat/Makefile
+++ b/math/readstat/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	readstat
 DISTVERSION=	1.1.8
+PORTREVISION=	1
 CATEGORIES=	math kde
 MASTER_SITES=	https://github.com/WizardMac/ReadStat/releases/download/v${DISTVERSION}/
 
@@ -12,4 +13,6 @@ LICENSE=	MIT
 USES=		libtool
 HAS_CONFIGURE=	yes
 
+CFLAGS+=	-Werror -Wstrict-prototypes
+
 .include <bsd.port.mk>
diff --git a/math/readstat/files/patch-src_readstat__bits.h b/math/readstat/files/patch-src_readstat__bits.h
new file mode 100644
index 000000000000..83dde0c07762
--- /dev/null
+++ b/math/readstat/files/patch-src_readstat__bits.h
@@ -0,0 +1,11 @@
+--- src/readstat_bits.h.orig	2023-02-19 12:35:46 UTC
++++ src/readstat_bits.h
+@@ -7,7 +7,7 @@
+ #undef READSTAT_MACHINE_IS_TWOS_COMPLEMENT
+ #define READSTAT_MACHINE_IS_TWOS_COMPLEMENT 0
+ 
+-int machine_is_little_endian();
++int machine_is_little_endian(void);
+ 
+ char ones_to_twos_complement1(char num);
+ int16_t ones_to_twos_complement2(int16_t num);
diff --git a/math/readstat/files/patch-src_readstat__variable.c b/math/readstat/files/patch-src_readstat__variable.c
new file mode 100644
index 000000000000..699c88937a9e
--- /dev/null
+++ b/math/readstat/files/patch-src_readstat__variable.c
@@ -0,0 +1,11 @@
+--- src/readstat_variable.c.orig	2023-02-19 12:39:09 UTC
++++ src/readstat_variable.c
+@@ -2,7 +2,7 @@
+ #include <stdlib.h>
+ #include "readstat.h"
+ 
+-static readstat_value_t make_blank_value();
++static readstat_value_t make_blank_value(void);
+ static readstat_value_t make_double_value(double dval);
+ 
+ static readstat_value_t make_blank_value() {
diff --git a/math/readstat/files/patch-src_sas_ieee.c b/math/readstat/files/patch-src_sas_ieee.c
new file mode 100644
index 000000000000..beab46c1713d
--- /dev/null
+++ b/math/readstat/files/patch-src_sas_ieee.c
@@ -0,0 +1,11 @@
+--- src/sas/ieee.c.orig	2023-02-19 12:37:34 UTC
++++ src/sas/ieee.c
+@@ -16,7 +16,7 @@ static void ieee2xpt(unsigned char *ieee, unsigned cha
+ 
+ #ifndef FLOATREP
+ #define FLOATREP get_native()
+-int get_native();
++int get_native(void);
+ #endif
+ 
+ void memreverse(void *intp_void, int l) {
diff --git a/math/readstat/files/patch-src_spss_readstat__por.h b/math/readstat/files/patch-src_spss_readstat__por.h
new file mode 100644
index 000000000000..7649ac223461
--- /dev/null
+++ b/math/readstat/files/patch-src_spss_readstat__por.h
@@ -0,0 +1,11 @@
+--- src/spss/readstat_por.h.orig	2023-02-19 12:38:04 UTC
++++ src/spss/readstat_por.h
+@@ -31,7 +31,7 @@ typedef struct por_ctx_s {
+     ck_hash_table_t *var_dict;
+ } por_ctx_t;
+ 
+-por_ctx_t *por_ctx_init();
++por_ctx_t *por_ctx_init(void);
+ void por_ctx_free(por_ctx_t *ctx);
+ ssize_t por_utf8_encode(const unsigned char *input, size_t input_len, 
+         char *output, size_t output_len, uint16_t lookup[256]);