View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] |
ID | Project | Category | View Status | Date Submitted | Last Update |
0003504 | Doomseeker | [All Projects] Bug | public | 2018-09-21 15:11 | 2018-10-06 18:19 |
|
Reporter | WubTheCaptain | |
Assigned To | WubTheCaptain | |
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | |
Platform | amd64 | OS | Debian GNU/Linux | OS Version | buster/sid |
Product Version | 1.2 | |
Target Version | 1.2 | Fixed in Version | 1.2 | |
|
Summary | 0003504: updaterevision: Implicit function declarations of popen(), pclose(), implicit int conversion |
Description | $ gcc -std=c99 tools/updaterevision/updaterevision.c
tools/updaterevision/updaterevision.c: In function ‘main’:
tools/updaterevision/updaterevision.c:65:11: warning: implicit declaration of function ‘popen’; did
you mean ‘fopen’? [-Wimplicit-function-declaration]
stream = popen("hg log --template \"{latesttag}-{latesttagdistance}-{node|short}\\n\"
--rev . && hg log -r. --template \"{date|isodatesec}*{node}?{date|hgdate}\\n\" &&
hg identify -n", "r");
^~~~~
fopen
tools/updaterevision/updaterevision.c:65:9: warning: assignment to ‘FILE *’ {aka ‘struct _IO_FILE
*’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
stream = popen("hg log --template \"{latesttag}-{latesttagdistance}-{node|short}\\n\"
--rev . && hg log -r. --template \"{date|isodatesec}*{node}?{date|hgdate}\\n\" &&
hg identify -n", "r");
^
tools/updaterevision/updaterevision.c:92:3: warning: implicit declaration of function ‘pclose’; did
you mean ‘fclose’? [-Wimplicit-function-declaration]
pclose(stream);
^~~~~~
fclose |
Additional Information | Caused by lack of #define _XOPEN_SOURCE 700 (or _POSIX_C_SOURCE >=2).
- libc6 2.27 (glibc)
- gcc-7 7.3.0 (GCC)
|
|
Attached Files | 0001-updaterevision-Add-required-feature-test-macro-for-glibc.patch [^] (1,108 bytes) 2018-09-21 15:28 [Show Content] [Hide Content]# HG changeset patch
# User Juuso Lapinlampi <wubthecaptain@gmail.com>
# Date 1537543658 0
# Fri Sep 21 15:27:38 2018 +0000
# Node ID 20baa04ba39c1fbe82a88a4e6743a4907ed4ed1c
# Parent 7a5abe18789f4cdd76ffa74e6f095ca3f41db203
updaterevision: Add required feature test macro for glibc
popen() and pclose() functions will be declared implicitly with glibc,
if at least _POSIX_C_SOURCE >= 2 is not defined. This feature test macro
is also included in _XOPEN_SOURCE (700 = Issue 7 of POSIX.1), so I'm
clever to utilize it.
I didn't bother checking if all requirements for using that macro are
met wrt. compliance, but it solves our problem with these warnings (and
we should really aim for compliance, anyway).
This same macro definition fixes FILE* implicit int conversion warning.
Fixes: #3504
diff --git a/tools/updaterevision/updaterevision.c b/tools/updaterevision/updaterevision.c
--- a/tools/updaterevision/updaterevision.c
+++ b/tools/updaterevision/updaterevision.c
@@ -7,6 +7,7 @@
*/
#define _CRT_SECURE_NO_DEPRECATE
+#define _XOPEN_SOURCE 700
#include <stdio.h>
#include <stdlib.h>
|
|