File: caddr_t.patch

package info (click to toggle)
nfs-ganesha 2.7.1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 10,044 kB
  • sloc: ansic: 144,377; cpp: 6,985; perl: 4,985; python: 2,766; sh: 2,604; lex: 606; yacc: 411; makefile: 67; awk: 22; lisp: 20
file content (40 lines) | stat: -rw-r--r-- 1,423 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From a91d57d6ce84bcf1c8c146c0a00b566b381fafa3 Mon Sep 17 00:00:00 2001
From: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Date: Wed, 21 Feb 2018 07:19:24 -0500
Subject: [PATCH] build: compile conf_lex.c with _GNU_SOURCE to get caddr_t definition

Build fails on prerelease of Ubuntu 18.04 (bionic) because caddr_t is
no longer implicitly defined when <sys/types.h> is #included.

Trying to untangle the #ifdefs and #ifndefs in <features.h> and
<sys/types.h> (which is /usr/include/sys/types.h on redhatish linux
and /usr/include/{x86_64-linux-gnu,...}/sys/types on debianish linux)
it is revealed that caddr_t is defined when __USE_MISC #defined.

And __USE_MISC is #defined when either _DEFAULT_SOURCE is defined or
_GNU_SOURCE is defined. (_DEFAULT_SOURCE is/was a replacement for
_BSD_SOURCE and/or SVID_SOURCE which were deprecated in g(nu)libc some
time ago.)

Some combination of distributions implicitly or explicitly enabling
newer and stricter ANSI C compilation has resulted, in the case of
Ubuntu 18.04 anyway, caddr_t not being defined.

Change-Id: Ie8eb79656fc5c3c48073b42f73bdcb92614b7c7c
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
---

--- a/src/config_parsing/CMakeLists.txt
+++ b/src/config_parsing/CMakeLists.txt
@@ -6,6 +6,11 @@ add_definitions(
   -D_GNU_SOURCE
 )
 
+add_definitions(
+  -D__USE_GNU
+  -D_GNU_SOURCE
+)
+
 BISON_TARGET(
   ConfigParser
   ${CMAKE_CURRENT_SOURCE_DIR}/conf_yacc.y