[ZBX-15294] Minor bugs in pcre.m4 Created: 2018 Dec 10 Updated: 2024 Apr 10 Resolved: 2018 Dec 13 | 
    |
| Status: | Closed | 
| Project: | ZABBIX BUGS AND ISSUES | 
| Component/s: | Installation (I) | 
| Affects Version/s: | 4.0.2, 4.2.0alpha1 | 
| Fix Version/s: | 4.0.3rc1, 4.2.0alpha2, 4.2 (plan) | 
| Type: | Problem report | Priority: | Trivial | 
| Reporter: | Andris Mednis | Assignee: | Andrejs Sitals (Inactive) | 
| Resolution: | Fixed | Votes: | 0 | 
| Labels: | codequality | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: | 
             GNU/Linux  | 
	||
| Team: | |
| Sprint: | Sprint 47, Dec 2018 | 
| Story Points: | 0.125 | 
| Description | 
| 
             There are bugs in file m4/pcre.m4 when pcre_compile() is called. conftest.c: In function 'main':
conftest.c:185:1: warning: old-style function definition [-Wold-style-definition]
conftest.c:190:49: warning: passing argument 3 of 'pcre_compile' from incompatible pointer type [-Wincompatible-pointer-types]
  pcre *regexp = pcre_compile("test", PCRE_UTF8, error, error_offset, 0);
                                                 ^~~~~
In file included from conftest.c:182:
/usr/include/pcre.h:540:21: note: expected 'const char **' but argument is of type 'const char *'
 PCRE_EXP_DECL pcre *pcre_compile(const char *, int, const char **, int *,
                     ^~~~~~~~~~~~
conftest.c:190:56: warning: passing argument 4 of 'pcre_compile' makes pointer from integer without a cast [-Wint-conversion]
  pcre *regexp = pcre_compile("test", PCRE_UTF8, error, error_offset, 0);
                                                        ^~~~~~~~~~~~
In file included from conftest.c:182:
/usr/include/pcre.h:540:21: note: expected 'int *' but argument is of type 'int'
 PCRE_EXP_DECL pcre *pcre_compile(const char *, int, const char **, int *,
                     ^~~~~~~~~~~~
but are stopped by C++ compiler (g++): conftest.c: In function 'int main()':
conftest.c:192:49: error: cannot convert 'const char*' to 'const char**'
  pcre *regexp = pcre_compile("test", PCRE_UTF8, error, error_offset, 0);
                                                 ^~~~~
In file included from conftest.c:184:
/usr/include/pcre.h:540:53: note:   initializing argument 3 of 'pcre* pcre_compile(const char*, int, const char**, int*, const unsigned char*)'
 PCRE_EXP_DECL pcre *pcre_compile(const char *, int, const char **, int *,
                                                     ^~~~~~~~~~~~~
It can be fixed with patch Index: m4/pcre.m4
===================================================================
--- m4/pcre.m4	(revision 87676)
+++ m4/pcre.m4	(working copy)
@@ -20,7 +20,7 @@
 [
 	const char* error = NULL;
 	int error_offset = -1;
-	pcre *regexp = pcre_compile("test", PCRE_UTF8, error, error_offset, 0);
+	pcre *regexp = pcre_compile("test", PCRE_UTF8, &error, &error_offset, NULL);
 	pcre_free(regexp);
 ],
 found_libpcre="yes")
 | 
    
| Comments | 
| Comment by Andrejs Sitals (Inactive) [ 2018 Dec 11 ] | 
| 
             Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-15294  | 
| Comment by Andrejs Sitals (Inactive) [ 2018 Dec 12 ] | 
| 
             Available in versions: 
  |