1*4882a593SmuzhiyunFrom 8cc60d618f81f2eeaa926cd60ed9b55ee6cda6ea Mon Sep 17 00:00:00 2001
2*4882a593SmuzhiyunFrom: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3*4882a593SmuzhiyunDate: Mon, 8 Aug 2016 15:42:46 +0200
4*4882a593SmuzhiyunSubject: [PATCH] addrdb/coord-config-parse.y: add missing <time.h> include
5*4882a593SmuzhiyunMIME-Version: 1.0
6*4882a593SmuzhiyunContent-Type: text/plain; charset=UTF-8
7*4882a593SmuzhiyunContent-Transfer-Encoding: 8bit
8*4882a593Smuzhiyun
9*4882a593SmuzhiyunThe %union definition uses the time_t structure. In order to use this
10*4882a593Smuzhiyunstructure, the <time.h> header has to be included. Otherwise, the build
11*4882a593Smuzhiyunbreaks with some C libraries, such as musl:
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunIn file included from coord-config-lex.l:23:0:
14*4882a593Smuzhiyuncoord-config-parse.y:107:2: error: unknown type name ‘time_t’
15*4882a593Smuzhiyun  time_t timestamp;
16*4882a593Smuzhiyun  ^
17*4882a593Smuzhiyun
18*4882a593SmuzhiyunThis patch includes <time.h> using the '%code requires' directive of
19*4882a593SmuzhiyunYacc.
20*4882a593Smuzhiyun
21*4882a593SmuzhiyunSigned-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
22*4882a593Smuzhiyun---
23*4882a593Smuzhiyun addrdb/coord-config-parse.y | 4 ++++
24*4882a593Smuzhiyun 1 file changed, 4 insertions(+)
25*4882a593Smuzhiyun
26*4882a593Smuzhiyundiff --git a/addrdb/coord-config-parse.y b/addrdb/coord-config-parse.y
27*4882a593Smuzhiyunindex 2e10a88..85ee058 100644
28*4882a593Smuzhiyun--- a/addrdb/coord-config-parse.y
29*4882a593Smuzhiyun+++ b/addrdb/coord-config-parse.y
30*4882a593Smuzhiyun@@ -102,6 +102,10 @@
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun %}
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun+%code requires {
35*4882a593Smuzhiyun+#include <time.h>
36*4882a593Smuzhiyun+}
37*4882a593Smuzhiyun+
38*4882a593Smuzhiyun %union {
39*4882a593Smuzhiyun 	unsigned long number;
40*4882a593Smuzhiyun 	time_t timestamp;
41*4882a593Smuzhiyun--
42*4882a593Smuzhiyun2.7.4
43*4882a593Smuzhiyun
44