From 0a7d0baf47dcc0aadb84e18d69e49e17c41e4a27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Fri, 8 May 2026 10:22:07 +0200 Subject: [PATCH 1/6] tre-internal: Remove duplicate prototype Fixes #138. --- lib/tre-internal.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/tre-internal.h b/lib/tre-internal.h index c055220..fcf5f14 100644 --- a/lib/tre-internal.h +++ b/lib/tre-internal.h @@ -277,11 +277,6 @@ tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string, ssize_t len, tre_str_type_t type, int *match_tags, int eflags, int *match_end_ofs); -reg_errcode_t -tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string, ssize_t len, - tre_str_type_t type, int *match_tags, int eflags, - int *match_end_ofs); - reg_errcode_t tre_tnfa_run_backtrack(const tre_tnfa_t *tnfa, const void *string, ssize_t len, tre_str_type_t type, int *match_tags, int eflags, From dd2e08f731a914bec6fdef61b602fb7d244043ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Fri, 8 May 2026 10:22:31 +0200 Subject: [PATCH 2/6] Normalize headers Normalize the top-of-file comment and include guard in all our headers. No functional change intended. --- lib/tre-ast.h | 14 ++++++-------- lib/tre-filter.h | 15 ++++++++++++--- lib/tre-internal.h | 13 ++++++------- lib/tre-match-utils.h | 16 +++++++++++----- lib/tre-mem.h | 15 ++++++--------- lib/tre-parse.h | 13 ++++++------- lib/tre-stack.h | 15 +++++++-------- lib/xmalloc.h | 17 ++++++++--------- local_includes/regex.h | 21 ++++++++++----------- local_includes/tre.h | 16 ++++++++-------- 10 files changed, 80 insertions(+), 75 deletions(-) diff --git a/lib/tre-ast.h b/lib/tre-ast.h index 190c4b0..361c008 100644 --- a/lib/tre-ast.h +++ b/lib/tre-ast.h @@ -1,14 +1,12 @@ /* - tre-ast.h - Abstract syntax tree (AST) definitions - - This software is released under a BSD-style license. - See the file LICENSE for details and copyright. - -*/ - + * tre-ast.h - Abstract syntax tree (AST) definitions + * + * This software is released under a BSD-style license. + * See the file LICENSE for details and copyright. + */ #ifndef TRE_AST_H -#define TRE_AST_H 1 +#define TRE_AST_H #include "tre-mem.h" #include "tre-internal.h" diff --git a/lib/tre-filter.h b/lib/tre-filter.h index 31d0b82..bc66449 100644 --- a/lib/tre-filter.h +++ b/lib/tre-filter.h @@ -1,6 +1,12 @@ +/* + * tre-filter.h - Histogram filter definitions + * + * This software is released under a BSD-style license. + * See the file LICENSE for details and copyright. + */ - - +#ifndef TRE_FILTER_H +#define TRE_FILTER_H typedef struct { unsigned char ch; @@ -14,6 +20,9 @@ typedef struct { tre_filter_profile_t *profile; } tre_filter_t; - int tre_filter_find(const unsigned char *str, size_t len, tre_filter_t *filter); + +#endif /* TRE_FILTER_H */ + +/* EOF */ diff --git a/lib/tre-internal.h b/lib/tre-internal.h index fcf5f14..a8c0d9c 100644 --- a/lib/tre-internal.h +++ b/lib/tre-internal.h @@ -1,13 +1,12 @@ /* - tre-internal.h - TRE internal definitions - - This software is released under a BSD-style license. - See the file LICENSE for details and copyright. - -*/ + * tre-internal.h - TRE internal definitions + * + * This software is released under a BSD-style license. + * See the file LICENSE for details and copyright. + */ #ifndef TRE_INTERNAL_H -#define TRE_INTERNAL_H 1 +#define TRE_INTERNAL_H #ifdef HAVE_WCHAR_H #include diff --git a/lib/tre-match-utils.h b/lib/tre-match-utils.h index 76e8b19..3caa675 100644 --- a/lib/tre-match-utils.h +++ b/lib/tre-match-utils.h @@ -1,10 +1,12 @@ /* - tre-match-utils.h - TRE matcher helper definitions + * tre-match-utils.h - TRE matcher helper definitions + * + * This software is released under a BSD-style license. + * See the file LICENSE for details and copyright. + */ - This software is released under a BSD-style license. - See the file LICENSE for details and copyright. - -*/ +#ifndef TRE_MATCH_UTILS_H +#define TRE_MATCH_UTILS_H #define str_source ((const tre_str_source*)string) @@ -213,3 +215,7 @@ tre_neg_char_classes_match(tre_ctype_t *classes, tre_cint_t wc, int icase) classes++; return 0; /* No match. */ } + +#endif /* TRE_MATCH_UTILS_H */ + +/* EOF */ diff --git a/lib/tre-mem.h b/lib/tre-mem.h index 2859404..99317a4 100644 --- a/lib/tre-mem.h +++ b/lib/tre-mem.h @@ -1,13 +1,12 @@ /* - tre-mem.h - TRE memory allocator interface - - This software is released under a BSD-style license. - See the file LICENSE for details and copyright. - -*/ + * tre-mem.h - TRE memory allocator interface + * + * This software is released under a BSD-style license. + * See the file LICENSE for details and copyright. + */ #ifndef TRE_MEM_H -#define TRE_MEM_H 1 +#define TRE_MEM_H #include @@ -27,7 +26,6 @@ typedef struct tre_mem_struct { void **provided; } *tre_mem_t; - tre_mem_t tre_mem_new_impl(int provided, void *provided_block); void *tre_mem_alloc_impl(tre_mem_t mem, int provided, void *provided_block, int zero, size_t size); @@ -57,7 +55,6 @@ void *tre_mem_alloc_impl(tre_mem_t mem, int provided, void *provided_block, : tre_mem_alloc_impl((mem), 1, alloca(TRE_MEM_BLOCK_SIZE), 0, (size))) #endif /* TRE_USE_ALLOCA */ - /* Frees the memory allocator and all memory allocated with it. */ void tre_mem_destroy(tre_mem_t mem); diff --git a/lib/tre-parse.h b/lib/tre-parse.h index 3fd40d4..11e5938 100644 --- a/lib/tre-parse.h +++ b/lib/tre-parse.h @@ -1,13 +1,12 @@ /* - tre-parse.c - Regexp parser definitions - - This software is released under a BSD-style license. - See the file LICENSE for details and copyright. - -*/ + * tre-parse.c - Regexp parser definitions + * + * This software is released under a BSD-style license. + * See the file LICENSE for details and copyright. + */ #ifndef TRE_PARSE_H -#define TRE_PARSE_H 1 +#define TRE_PARSE_H /* Parse context. */ typedef struct { diff --git a/lib/tre-stack.h b/lib/tre-stack.h index 1408f32..3e74bf6 100644 --- a/lib/tre-stack.h +++ b/lib/tre-stack.h @@ -1,14 +1,13 @@ /* - tre-stack.h: Stack definitions - - This software is released under a BSD-style license. - See the file LICENSE for details and copyright. - -*/ - + * tre-stack.h: Stack definitions + * + * This software is released under a BSD-style license. + * See the file LICENSE for details and copyright. + * + */ #ifndef TRE_STACK_H -#define TRE_STACK_H 1 +#define TRE_STACK_H #include "../local_includes/tre.h" diff --git a/lib/xmalloc.h b/lib/xmalloc.h index ce310af..4942c57 100644 --- a/lib/xmalloc.h +++ b/lib/xmalloc.h @@ -1,13 +1,12 @@ /* - xmalloc.h - Simple malloc debugging library API + * xmalloc.h - Simple malloc debugging library API + * + * This software is released under a BSD-style license. + * See the file LICENSE for details and copyright. + */ - This software is released under a BSD-style license. - See the file LICENSE for details and copyright. - -*/ - -#ifndef _XMALLOC_H -#define _XMALLOC_H 1 +#ifndef TRE_XMALLOC_H +#define TRE_XMALLOC_H void *xmalloc_impl(size_t size, const char *file, int line, const char *func); void *xcalloc_impl(size_t nmemb, size_t size, const char *file, int line, @@ -72,6 +71,6 @@ void xmalloc_configure(int fail_after); #endif /* !MALLOC_DEBUGGING */ #endif /* !XMALLOC_INTERNAL */ -#endif /* _XMALLOC_H */ +#endif /* TRE_XMALLOC_H */ /* EOF */ diff --git a/local_includes/regex.h b/local_includes/regex.h index 5a29aa9..4fe4ce0 100644 --- a/local_includes/regex.h +++ b/local_includes/regex.h @@ -1,17 +1,16 @@ /* - regex.h - TRE legacy API - - This software is released under a BSD-style license. - See the file LICENSE for details and copyright. - - This header is for source level compatibility with old code using - the header which defined the TRE API functions without - a prefix. New code should include instead. - -*/ + * regex.h - TRE legacy API + * + * This software is released under a BSD-style license. + * See the file LICENSE for details and copyright. + * + * This header is for source level compatibility with old code using + * the header which defined the TRE API functions without + * a prefix. New code should include instead. + */ #ifndef TRE_REGEX_H -#define TRE_REGEX_H 1 +#define TRE_REGEX_H #ifdef USE_LOCAL_TRE_H /* Use the header(s) from the TRE package that this file is part of. diff --git a/local_includes/tre.h b/local_includes/tre.h index 6751539..a67b9bb 100644 --- a/local_includes/tre.h +++ b/local_includes/tre.h @@ -1,13 +1,12 @@ /* - tre.h - TRE public API definitions - - This software is released under a BSD-style license. - See the file LICENSE for details and copyright. - -*/ + * tre.h - TRE public API definitions + * + * This software is released under a BSD-style license. + * See the file LICENSE for details and copyright. + */ #ifndef TRE_H -#define TRE_H 1 +#define TRE_H #ifdef USE_LOCAL_TRE_H /* Make certain to use the header(s) from the TRE package that this @@ -339,6 +338,7 @@ tre_have_approx(const regex_t *preg); #ifdef __cplusplus } #endif -#endif /* TRE_H */ + +#endif /* TRE_H */ /* EOF */ From 47efe30f2958d526642294539f82634c77eb447a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Fri, 8 May 2026 11:27:05 +0200 Subject: [PATCH 3/6] Revert local_includes hack This was never a good idea, and it is moot now anyway since the stated reason for it (the python extension module) is currently unbuildable. --- Makefile.am | 2 +- configure.ac | 9 +++------ include/Makefile.am | 1 + {local_includes => include/tre}/Makefile.am | 0 {local_includes => include/tre}/regex.h | 10 ---------- {local_includes => include/tre}/tre-config.h.in | 0 {local_includes => include/tre}/tre.h | 7 ------- lib/Makefile.am | 2 +- lib/tre-internal.h | 11 ++++++----- lib/tre-stack.h | 2 -- python/setup.py | 5 ++--- python/setup.py.in | 5 ++--- python/tre-python.c | 9 --------- src/Makefile.am | 2 +- src/agrep.c | 4 +--- tests/Makefile.am | 4 ++-- win32/retest.vcxproj | 6 +++--- win32/test-str-source.vcxproj | 6 +++--- win32/tre.vcxproj | 6 +++--- 19 files changed, 29 insertions(+), 62 deletions(-) create mode 100644 include/Makefile.am rename {local_includes => include/tre}/Makefile.am (100%) rename {local_includes => include/tre}/regex.h (69%) rename {local_includes => include/tre}/tre-config.h.in (100%) rename {local_includes => include/tre}/tre.h (97%) diff --git a/Makefile.am b/Makefile.am index 0bf5fe5..064b409 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,7 +6,7 @@ else agrep_dirs = endif -SUBDIRS = local_includes lib $(agrep_dirs) tests utils po m4 +SUBDIRS = include lib $(agrep_dirs) tests utils po m4 EXTRA_DIST = \ LICENSE \ diff --git a/configure.ac b/configure.ac index 1ac8ee3..72038e2 100644 --- a/configure.ac +++ b/configure.ac @@ -100,10 +100,6 @@ else AM_CONDITIONAL(TRE_AGREP, false) fi - -dnl Make sure locally configured headers are used (this adds the #define to config.h). -AC_DEFINE(USE_LOCAL_TRE_H, 1, [ Define to ensure locally configured headers are used ]) - AC_ARG_WITH(alloca, AS_HELP_STRING( [--without-alloca], @@ -520,12 +516,13 @@ AM_GNU_GETTEXT([external]) LT_INIT([win32-dll, disable-static]) dnl Output files -AC_CONFIG_HEADERS([config.h local_includes/tre-config.h]) +AC_CONFIG_HEADERS([config.h include/tre/tre-config.h]) AC_CONFIG_FILES([ Makefile doc/Makefile doc/agrep.1 -local_includes/Makefile +include/Makefile +include/tre/Makefile lib/Makefile m4/Makefile po/Makefile.in diff --git a/include/Makefile.am b/include/Makefile.am new file mode 100644 index 0000000..eb2213a --- /dev/null +++ b/include/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = tre diff --git a/local_includes/Makefile.am b/include/tre/Makefile.am similarity index 100% rename from local_includes/Makefile.am rename to include/tre/Makefile.am diff --git a/local_includes/regex.h b/include/tre/regex.h similarity index 69% rename from local_includes/regex.h rename to include/tre/regex.h index 4fe4ce0..77a06e9 100644 --- a/local_includes/regex.h +++ b/include/tre/regex.h @@ -12,17 +12,7 @@ #ifndef TRE_REGEX_H #define TRE_REGEX_H -#ifdef USE_LOCAL_TRE_H -/* Use the header(s) from the TRE package that this file is part of. - (Yes, this file is in local_include too, but the explict path - means there is no way to get a system tre.h by accident.) */ -#include "../local_includes/tre.h" -#else -/* Use the header(s) from an installed version of the TRE package - (so that this application matches the installed libtre), - not the one(s) in the local_includes directory. */ #include -#endif #ifndef TRE_USE_SYSTEM_REGEX_H #define regcomp tre_regcomp diff --git a/local_includes/tre-config.h.in b/include/tre/tre-config.h.in similarity index 100% rename from local_includes/tre-config.h.in rename to include/tre/tre-config.h.in diff --git a/local_includes/tre.h b/include/tre/tre.h similarity index 97% rename from local_includes/tre.h rename to include/tre/tre.h index a67b9bb..000a93e 100644 --- a/local_includes/tre.h +++ b/include/tre/tre.h @@ -8,14 +8,7 @@ #ifndef TRE_H #define TRE_H -#ifdef USE_LOCAL_TRE_H -/* Make certain to use the header(s) from the TRE package that this - file is part of by giving the full path to the header from this directory. */ -#include "../local_includes/tre-config.h" -#else -/* Use the header in the same directory as this file if there is one. */ #include "tre-config.h" -#endif #ifdef HAVE_SYS_TYPES_H #include diff --git a/lib/Makefile.am b/lib/Makefile.am index 4e5524b..c7f6017 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -2,7 +2,7 @@ lib_LTLIBRARIES = libtre.la libtre_la_LDFLAGS = -no-undefined -version-info 5:0:0 $(LDFLAGS) libtre_la_LIBADD = $(LTLIBINTL) -AM_CPPFLAGS = -I$(top_srcdir)/include/tre +AM_CPPFLAGS = -I$(top_srcdir)/include noinst_HEADERS = \ tre-ast.h \ diff --git a/lib/tre-internal.h b/lib/tre-internal.h index a8c0d9c..9a7f6e9 100644 --- a/lib/tre-internal.h +++ b/lib/tre-internal.h @@ -8,6 +8,10 @@ #ifndef TRE_INTERNAL_H #define TRE_INTERNAL_H +#ifdef HAVE_SYS_TYPES_H +#include +#endif /* HAVE_SYS_TYPES_H */ + #ifdef HAVE_WCHAR_H #include #endif /* HAVE_WCHAR_H */ @@ -16,13 +20,10 @@ #include #endif /* HAVE_WCTYPE_H */ -#ifdef HAVE_SYS_TYPES_H -#include -#endif /* HAVE_SYS_TYPES_H */ - #include #include -#include "../local_includes/tre.h" + +#include "tre/tre.h" #define TRE_MAX_RE 65536 #define TRE_MAX_STRING INT_MAX diff --git a/lib/tre-stack.h b/lib/tre-stack.h index 3e74bf6..2a68e09 100644 --- a/lib/tre-stack.h +++ b/lib/tre-stack.h @@ -9,8 +9,6 @@ #ifndef TRE_STACK_H #define TRE_STACK_H -#include "../local_includes/tre.h" - typedef struct tre_stack_rec tre_stack_t; /* Creates a new stack object with initial size `size' and maximum size diff --git a/python/setup.py b/python/setup.py index 866f543..f561640 100644 --- a/python/setup.py +++ b/python/setup.py @@ -11,7 +11,7 @@ version = "0.9.0" data_files = [] -include_dirs = ["../local_includes"] +include_dirs = ["../include"] library_dirs = ["../lib/.libs"] libraries = ["tre"] @@ -32,8 +32,7 @@ data_files = data_files, ext_modules = [Extension("tre", sources = ["tre-python.c"], - define_macros = [("HAVE_CONFIG_H", None), - ("USE_LOCAL_TRE_H",1)], + define_macros = [("HAVE_CONFIG_H", None)], include_dirs = include_dirs, library_dirs = library_dirs, libraries = libraries diff --git a/python/setup.py.in b/python/setup.py.in index f3cbbcd..c007299 100644 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -11,7 +11,7 @@ import shutil version = "@TRE_VERSION@" data_files = [] -include_dirs = ["../local_includes"] +include_dirs = ["../include"] library_dirs = ["../lib/.libs"] libraries = ["tre"] @@ -32,8 +32,7 @@ setup(name = "tre", data_files = data_files, ext_modules = [Extension("tre", sources = ["tre-python.c"], - define_macros = [("HAVE_CONFIG_H", None), - ("USE_LOCAL_TRE_H",1)], + define_macros = [("HAVE_CONFIG_H", None)], include_dirs = include_dirs, library_dirs = library_dirs, libraries = libraries diff --git a/python/tre-python.c b/python/tre-python.c index dcbac81..439e17c 100644 --- a/python/tre-python.c +++ b/python/tre-python.c @@ -26,16 +26,7 @@ #include "Python.h" #include "structmember.h" -#ifdef USE_LOCAL_TRE_H -/* Make certain to use the header(s) from the TRE package that this - file is part of by giving the full path to the header from this directory. */ -#include "../local_includes/tre.h" -#else -/* Use the header(s) from an installed version of the TRE package - (so that this extension matches the installed libtre), - not the one(s) in the local_includes directory. */ #include -#endif /* Define this if you want to release the GIL during compilation or searching. This builds and runs, but has not been tested with a multi-threaded test case. diff --git a/src/Makefile.am b/src/Makefile.am index 6f1772c..7cf1cb5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,7 @@ ## Process this file with automake to produce Makefile.in localedir = $(datadir)/locale -AM_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir)/include/tre +AM_CPPFLAGS = -I$(top_srcdir)/include if TRE_AGREP bin_PROGRAMS = agrep diff --git a/src/agrep.c b/src/agrep.c index 9d2d0c6..f84f849 100644 --- a/src/agrep.c +++ b/src/agrep.c @@ -23,9 +23,7 @@ #ifdef HAVE_GETOPT_H #include #endif /* HAVE_GETOPT_H */ -/* Make certain we get the legacy TRE specific regex.h and not any - potential system regex.h by giving an explict path to the header. */ -#include "../local_includes/regex.h" +#include #ifdef HAVE_GETTEXT #include diff --git a/tests/Makefile.am b/tests/Makefile.am index 076118d..4fbe7e2 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,6 +1,8 @@ ## Process this file with automake to produce Makefile.in AUTOMAKE_OPTIONS = subdir-objects +AM_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir)/include + SUBDIRS = agrep check_PROGRAMS = retest randtest test-str-source @@ -60,8 +62,6 @@ endif TRE_MULTIBYTE randtest_LDADD = libxtre.la $(LDADD) endif !TRE_DEBUG -AM_CPPFLAGS = -I$(top_srcdir)/lib - EXTRA_DIST = build-tests.sh TESTS = test-str-source retest diff --git a/win32/retest.vcxproj b/win32/retest.vcxproj index 1c0db23..eff63a2 100644 --- a/win32/retest.vcxproj +++ b/win32/retest.vcxproj @@ -60,7 +60,7 @@ MaxSpeed OnlyExplicitInline - ../lib;../win32;%(AdditionalIncludeDirectories) + ../win32;../lib;../include;%(AdditionalIncludeDirectories) NDEBUG;WIN32;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) true MultiThreaded @@ -98,7 +98,7 @@ Disabled - ../lib;../win32;%(AdditionalIncludeDirectories) + ../win32;../lib;../include;%(AdditionalIncludeDirectories) _DEBUG;WIN32;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) true EnableFastChecks @@ -143,4 +143,4 @@ - \ No newline at end of file + diff --git a/win32/test-str-source.vcxproj b/win32/test-str-source.vcxproj index c547163..064da65 100644 --- a/win32/test-str-source.vcxproj +++ b/win32/test-str-source.vcxproj @@ -60,7 +60,7 @@ MaxSpeed OnlyExplicitInline - ../lib;../win32;%(AdditionalIncludeDirectories) + ../win32;../lib;../include;%(AdditionalIncludeDirectories) NDEBUG;WIN32;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) true MultiThreaded @@ -98,7 +98,7 @@ Disabled - ../lib;../win32;%(AdditionalIncludeDirectories) + ../win32;../lib;../include;%(AdditionalIncludeDirectories) _DEBUG;WIN32;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) true EnableFastChecks @@ -143,4 +143,4 @@ - \ No newline at end of file + diff --git a/win32/tre.vcxproj b/win32/tre.vcxproj index cdebcd7..fb1ec91 100644 --- a/win32/tre.vcxproj +++ b/win32/tre.vcxproj @@ -63,7 +63,7 @@ Disabled - ../win32;../lib;%(AdditionalIncludeDirectories) + ../win32;../lib;../include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;TRE_EXPORTS;TRE_DEBUG;HAVE_CONFIG_H;%(PreprocessorDefinitions) true EnableFastChecks @@ -110,7 +110,7 @@ MaxSpeed OnlyExplicitInline - ../win32;../lib;%(AdditionalIncludeDirectories) + ../win32;../lib;../include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;TRE_EXPORTS;HAVE_CONFIG_H;%(PreprocessorDefinitions) true MultiThreadedDLL @@ -175,4 +175,4 @@ - \ No newline at end of file + From 4d251d6333e1dbe95b45ecc482f909d74d3bca67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Sat, 9 May 2026 01:16:40 +0200 Subject: [PATCH 4/6] configure: Silence warnings Request slightly newer versions of autoconf and gettext to silence warnings from automake. --- configure.ac | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 72038e2..e578a59 100644 --- a/configure.ac +++ b/configure.ac @@ -1,11 +1,12 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT([TRE], [0.9.0]) +AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR([lib/regcomp.c]) AC_CONFIG_AUX_DIR([utils]) AC_CANONICAL_TARGET AM_INIT_AUTOMAKE([foreign]) -AC_PREREQ([2.63]) -AM_GNU_GETTEXT_VERSION(0.17) +AC_PREREQ([2.69]) +AM_GNU_GETTEXT_VERSION(0.19) dnl Checks for programs. AC_PROG_CC From 03b5c95eb261288b122ea1e62944bd500b1d38c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Sat, 9 May 2026 01:48:21 +0200 Subject: [PATCH 5/6] win32: Fix build issues * Add missing x64 target definitions. * Update config.h.in, not just config.h, so the latter gets regenerated correctly. * Use correct line endings. Fixes: 13759f228dbb ("Update project files for Visual Studio 2022.") --- .gitattributes | 1 + win32/config.h.in | 14 +- win32/retest.vcxproj | 114 ++++++++++ win32/test-str-source.vcxproj | 406 ++++++++++++++++++++++------------ win32/tre.sln | 16 +- win32/tre.vcxproj | 124 +++++++++++ 6 files changed, 518 insertions(+), 157 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..e98033e --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +/win32 text eol=crlf diff --git a/win32/config.h.in b/win32/config.h.in index 34e438a..e52d9f6 100644 --- a/win32/config.h.in +++ b/win32/config.h.in @@ -171,9 +171,17 @@ /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ -/* Define as `__inline' if that's what the C compiler calls it, or to nothing - if it is not supported. */ -#define inline __inline +/* Define to '__inline__' or '__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define as 'unsigned int' if doesn't define. */ +/* #undef size_t */ + +/* Define as 'int' if doesn't define. */ +#define ssize_t long /* Avoid silly warnings about "insecure" functions. */ #define _CRT_SECURE_NO_DEPRECATE 1 diff --git a/win32/retest.vcxproj b/win32/retest.vcxproj index eff63a2..a7f5db1 100644 --- a/win32/retest.vcxproj +++ b/win32/retest.vcxproj @@ -5,10 +5,18 @@ Debug Win32 + + Debug + x64 + Release Win32 + + Release + x64 + 17.0 @@ -21,12 +29,24 @@ false MultiByte + + Application + v143 + false + MultiByte + Application v143 false MultiByte + + Application + v143 + false + MultiByte + @@ -34,10 +54,18 @@ + + + + + + + + <_ProjectFileVersion>17.0.35219.272 @@ -47,11 +75,17 @@ .\Release\ false + + false + .\Debug\ .\Debug\ true + + true + .\Release/retest.tlb @@ -91,6 +125,46 @@ .\Release/retest.bsc + + + .\Release/retest.tlb + + + + + MaxSpeed + OnlyExplicitInline + ../win32;../lib;../include;%(AdditionalIncludeDirectories) + NDEBUG;WIN32;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + MultiThreaded + true + .\Release/retest.pch + .\Release/ + .\Release/ + .\Release/ + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040b + + + Release/tre.lib;msvcprt.lib;%(AdditionalDependencies) + .\Release/retest.exe + true + .\Release/retest.pdb + Console + false + + + + + true + .\Release/retest.bsc + + .\Debug/retest.tlb @@ -131,6 +205,46 @@ .\Debug/retest.bsc + + + .\Debug/retest.tlb + + + + + Disabled + ../win32;../lib;../include;%(AdditionalIncludeDirectories) + _DEBUG;WIN32;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + .\Debug/retest.pch + .\Debug/ + .\Debug/ + .\Debug/ + Level3 + true + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x040b + + + Debug/tre.lib;msvcprt.lib;%(AdditionalDependencies) + .\Debug/retest.exe + true + true + .\Debug/retest.pdb + Console + false + + + + + true + .\Debug/retest.bsc + + diff --git a/win32/test-str-source.vcxproj b/win32/test-str-source.vcxproj index 064da65..b74a29a 100644 --- a/win32/test-str-source.vcxproj +++ b/win32/test-str-source.vcxproj @@ -1,146 +1,260 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - 17.0 - {B2EF4770-CEFE-4583-94C0-F92130BA2AF6} - - - - Application - v143 - false - MultiByte - - - Application - v143 - false - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>17.0.35219.272 - - - .\Release\ - .\Release\ - false - - - .\Debug\ - .\Debug\ - true - - - - .\Release/test-str-source.tlb - - - - MaxSpeed - OnlyExplicitInline - ../win32;../lib;../include;%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) - true - MultiThreaded - true - .\Release/test-str-source.pch - .\Release/ - .\Release/ - .\Release/ - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x040b - - - Release/tre.lib;msvcprt.lib;%(AdditionalDependencies) - .\Release/test-str-source.exe - true - .\Release/test-str-source.pdb - Console - false - - MachineX86 - - - true - .\Release/test-str-source.bsc - - - - - .\Debug/test-str-source.tlb - - - - Disabled - ../win32;../lib;../include;%(AdditionalIncludeDirectories) - _DEBUG;WIN32;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - .\Debug/test-str-source.pch - .\Debug/ - .\Debug/ - .\Debug/ - Level3 - true - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - 0x040b - - - Debug/tre.lib;msvcprt.lib;%(AdditionalDependencies) - .\Debug/test-str-source.exe - true - true - .\Debug/test-str-source.pdb - Console - false - - MachineX86 - - - true - .\Debug/test-str-source.bsc - - - - - - - - {69258b5d-ecae-40e4-8f64-5f063b05c998} - false - - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + 17.0 + {B2EF4770-CEFE-4583-94C0-F92130BA2AF6} + + + + Application + v143 + false + MultiByte + + + Application + v143 + false + MultiByte + + + Application + v143 + false + MultiByte + + + Application + v143 + false + MultiByte + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>17.0.35219.272 + + + .\Release\ + .\Release\ + false + + + false + + + .\Debug\ + .\Debug\ + true + + + true + + + + .\Release/test-str-source.tlb + + + + MaxSpeed + OnlyExplicitInline + ../win32;../lib;../include;%(AdditionalIncludeDirectories) + NDEBUG;WIN32;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + MultiThreaded + true + .\Release/test-str-source.pch + .\Release/ + .\Release/ + .\Release/ + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040b + + + Release/tre.lib;msvcprt.lib;%(AdditionalDependencies) + .\Release/test-str-source.exe + true + .\Release/test-str-source.pdb + Console + false + + MachineX86 + + + true + .\Release/test-str-source.bsc + + + + + .\Release/test-str-source.tlb + + + + + MaxSpeed + OnlyExplicitInline + ../win32;../lib;../include;%(AdditionalIncludeDirectories) + NDEBUG;WIN32;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + MultiThreaded + true + .\Release/test-str-source.pch + .\Release/ + .\Release/ + .\Release/ + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040b + + + Release/tre.lib;msvcprt.lib;%(AdditionalDependencies) + .\Release/test-str-source.exe + true + .\Release/test-str-source.pdb + Console + false + + + + + true + .\Release/test-str-source.bsc + + + + + .\Debug/test-str-source.tlb + + + + Disabled + ../win32;../lib;../include;%(AdditionalIncludeDirectories) + _DEBUG;WIN32;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + .\Debug/test-str-source.pch + .\Debug/ + .\Debug/ + .\Debug/ + Level3 + true + EditAndContinue + + + _DEBUG;%(PreprocessorDefinitions) + 0x040b + + + Debug/tre.lib;msvcprt.lib;%(AdditionalDependencies) + .\Debug/test-str-source.exe + true + true + .\Debug/test-str-source.pdb + Console + false + + MachineX86 + + + true + .\Debug/test-str-source.bsc + + + + + .\Debug/test-str-source.tlb + + + + + Disabled + ../win32;../lib;../include;%(AdditionalIncludeDirectories) + _DEBUG;WIN32;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + .\Debug/test-str-source.pch + .\Debug/ + .\Debug/ + .\Debug/ + Level3 + true + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x040b + + + Debug/tre.lib;msvcprt.lib;%(AdditionalDependencies) + .\Debug/test-str-source.exe + true + true + .\Debug/test-str-source.pdb + Console + false + + + + + true + .\Debug/test-str-source.bsc + + + + + + + + {69258b5d-ecae-40e4-8f64-5f063b05c998} + false + + + + + + diff --git a/win32/tre.sln b/win32/tre.sln index c21c2bf..2a1b82f 100644 --- a/win32/tre.sln +++ b/win32/tre.sln @@ -19,20 +19,20 @@ Global GlobalSection(ProjectConfigurationPlatforms) = postSolution {F9A3C846-B5B3-4A68-9F8D-A918942FFB29}.Debug|Win32.ActiveCfg = Debug|Win32 {F9A3C846-B5B3-4A68-9F8D-A918942FFB29}.Debug|Win32.Build.0 = Debug|Win32 - {F9A3C846-B5B3-4A68-9F8D-A918942FFB29}.Debug|x64.ActiveCfg = Debug|Win32 - {F9A3C846-B5B3-4A68-9F8D-A918942FFB29}.Debug|x64.Build.0 = Debug|Win32 + {F9A3C846-B5B3-4A68-9F8D-A918942FFB29}.Debug|x64.ActiveCfg = Debug|x64 + {F9A3C846-B5B3-4A68-9F8D-A918942FFB29}.Debug|x64.Build.0 = Debug|x64 {F9A3C846-B5B3-4A68-9F8D-A918942FFB29}.Release|Win32.ActiveCfg = Release|Win32 {F9A3C846-B5B3-4A68-9F8D-A918942FFB29}.Release|Win32.Build.0 = Release|Win32 - {F9A3C846-B5B3-4A68-9F8D-A918942FFB29}.Release|x64.ActiveCfg = Release|Win32 - {F9A3C846-B5B3-4A68-9F8D-A918942FFB29}.Release|x64.Build.0 = Release|Win32 + {F9A3C846-B5B3-4A68-9F8D-A918942FFB29}.Release|x64.ActiveCfg = Release|x64 + {F9A3C846-B5B3-4A68-9F8D-A918942FFB29}.Release|x64.Build.0 = Release|x64 {69258B5D-ECAE-40E4-8F64-5F063B05C998}.Debug|Win32.ActiveCfg = Debug|Win32 {69258B5D-ECAE-40E4-8F64-5F063B05C998}.Debug|Win32.Build.0 = Debug|Win32 - {69258B5D-ECAE-40E4-8F64-5F063B05C998}.Debug|x64.ActiveCfg = Debug|Win32 - {69258B5D-ECAE-40E4-8F64-5F063B05C998}.Debug|x64.Build.0 = Debug|Win32 + {69258B5D-ECAE-40E4-8F64-5F063B05C998}.Debug|x64.ActiveCfg = Debug|x64 + {69258B5D-ECAE-40E4-8F64-5F063B05C998}.Debug|x64.Build.0 = Debug|x64 {69258B5D-ECAE-40E4-8F64-5F063B05C998}.Release|Win32.ActiveCfg = Release|Win32 {69258B5D-ECAE-40E4-8F64-5F063B05C998}.Release|Win32.Build.0 = Release|Win32 - {69258B5D-ECAE-40E4-8F64-5F063B05C998}.Release|x64.ActiveCfg = Release|Win32 - {69258B5D-ECAE-40E4-8F64-5F063B05C998}.Release|x64.Build.0 = Release|Win32 + {69258B5D-ECAE-40E4-8F64-5F063B05C998}.Release|x64.ActiveCfg = Release|x64 + {69258B5D-ECAE-40E4-8F64-5F063B05C998}.Release|x64.Build.0 = Release|x64 {B2EF4770-CEFE-4583-94C0-F92130BA2AF6}.Debug|Win32.ActiveCfg = Debug|Win32 {B2EF4770-CEFE-4583-94C0-F92130BA2AF6}.Debug|Win32.Build.0 = Debug|Win32 {B2EF4770-CEFE-4583-94C0-F92130BA2AF6}.Debug|x64.ActiveCfg = Debug|x64 diff --git a/win32/tre.vcxproj b/win32/tre.vcxproj index fb1ec91..e8f400e 100644 --- a/win32/tre.vcxproj +++ b/win32/tre.vcxproj @@ -5,10 +5,18 @@ Debug Win32 + + Debug + x64 + Release Win32 + + Release + x64 + 17.0 @@ -21,12 +29,24 @@ false MultiByte + + DynamicLibrary + v143 + false + MultiByte + DynamicLibrary v143 false MultiByte + + DynamicLibrary + v143 + false + MultiByte + @@ -34,10 +54,18 @@ + + + + + + + + <_ProjectFileVersion>17.0.35219.272 @@ -47,11 +75,17 @@ .\Debug\ true + + true + .\Release\ .\Release\ false + + false + _DEBUG;%(PreprocessorDefinitions) @@ -98,6 +132,51 @@ .\Debug/tre.bsc + + + _DEBUG;%(PreprocessorDefinitions) + true + true + .\Debug/tre.tlb + + + + + Disabled + ../win32;../lib;../include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;TRE_EXPORTS;TRE_DEBUG;HAVE_CONFIG_H;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + .\Debug/tre.pch + .\Debug/ + .\Debug/ + .\Debug/ + true + Level3 + true + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x040c + + + msvcprt.lib;%(AdditionalDependencies) + .\Debug/tre.dll + true + .\tre.def + true + .\Debug/tre.pdb + false + + + .\Debug/tre.lib + + + true + .\Debug/tre.bsc + + NDEBUG;%(PreprocessorDefinitions) @@ -143,6 +222,51 @@ .\Release/tre.bsc + + + NDEBUG;%(PreprocessorDefinitions) + true + true + .\Release/tre.tlb + + + + + MaxSpeed + OnlyExplicitInline + ../win32;../lib;../include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;TRE_EXPORTS;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + .\Release/tre.pch + .\Release/ + .\Release/ + .\Release/ + true + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + msvcrt.lib;msvcprt.lib;%(AdditionalDependencies) + .\Release/tre.dll + true + .\tre.def + .\Release/tre.pdb + false + + + .\Release/tre.lib + + + true + .\Release/tre.bsc + + From 07bd6d94b33cd81c71bdfed59503baec668c7e35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Sun, 10 May 2026 11:09:06 +0200 Subject: [PATCH 6/6] win32: Fix ssize_t definition Now that we've fixed the x64 build, we need to define ssize_t as either a 64-bit signed int (for win64) or a 32-bit signed int (for win32). --- win32/config.h | 6 +++++- win32/config.h.in | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/win32/config.h b/win32/config.h index 3c4fecf..33f1455 100644 --- a/win32/config.h +++ b/win32/config.h @@ -181,7 +181,11 @@ /* #undef size_t */ /* Define as 'int' if doesn't define. */ -#define ssize_t long +#ifdef _WIN64 +#define ssize_t __int64 +#else +#define ssize_t __int32 +#endif /* Avoid silly warnings about "insecure" functions. */ #define _CRT_SECURE_NO_DEPRECATE 1 diff --git a/win32/config.h.in b/win32/config.h.in index e52d9f6..ebeefb6 100644 --- a/win32/config.h.in +++ b/win32/config.h.in @@ -181,7 +181,11 @@ /* #undef size_t */ /* Define as 'int' if doesn't define. */ -#define ssize_t long +#ifdef _WIN64 +#define ssize_t __int64 +#else +#define ssize_t __int32 +#endif /* Avoid silly warnings about "insecure" functions. */ #define _CRT_SECURE_NO_DEPRECATE 1