From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 From: Kyohei Kadota Date: Fri, 3 Aug 2018 23:35:21 +0900 Message-ID: To: 9fans@9fans.net Content-Type: multipart/alternative; boundary="0000000000001325ea057288d7ae" Subject: [9fans] question about #include_next directive Topicbox-Message-UUID: d9b5ae58-ead9-11e9-9d60-3106f5b1d025 --0000000000001325ea057288d7ae Content-Type: text/plain; charset="UTF-8" Hi, fans. I'm trying to port LibreSSL on native Plan 9. Some functions are works now: 1. git clone https://github.com/lufia/portable && cd portable 2. rc ./update.rc 3. ape/patch -p0 #endif ! #line 1 "/usr/lufia/" cpp: :2 Unknown preprocessor control include_next I had no choice but to rewrite #include_next like: compat.h: #ifdef Plan9 #define SYS_PATH(x) /sys/include/ape/x #else #define SYS_PATH(x) sys_##x #endif #define SYSINCLUDE(x) string.h: #include SYSINCLUDE(string.h) sys_string.h: #include_next This works but I think this way is not good because developer should manage two files. Is there any good way? --0000000000001325ea057288d7ae Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi, fans.

I'm trying to = port LibreSSL on native Plan 9.
Some functions are works now:

=C2=A0 =C2=A0 1. git clone https://github.com/lufia/portable && cd por= table
=C2=A0 =C2=A0 2. rc ./update.rc
=C2=A0 =C2=A0 3. = ape/patch -p0 <plan9/crypto.patch
=C2=A0 =C2=A0 4. ape/patch -= p0 <plan9/ssl.patch
=C2=A0 =C2=A0 5. ape/patch -p0 <plan9/a= pps.patch
=C2=A0 =C2=A0 6. for(i in crypto ssl apps/openssl) @{ c= d $i; mk }

I have difficulty in porting header fil= es.
Some headers of LibreSSL has #include_next GCC extended direc= tive, but Plan 9's cpp can't process #include_next directive.
=
When cpp processes a header containing #include_next, it exits with &q= uot;Unknown preprocessor control #include_next" error even if ignoring= by #if and #endif.

=C2=A0 =C2=A0 % cat <<! = | cpp
=C2=A0 =C2=A0 #if 0
=C2=A0 =C2=A0 #include_next &= lt;u.h>
=C2=A0 =C2=A0 #endif
=C2=A0 =C2=A0 !
=C2=A0 =C2=A0 #line 1 "/usr/lufia/<stdin>"
=C2=A0 =C2=A0 cpp: <stdin>:2 Unknown preprocessor control include_n= ext

I had no choice but to rewrite #include_= next like:

compat.h:
=C2=A0 =C2=A0 #ifde= f Plan9
=C2=A0 =C2=A0 #define SYS_PATH(x) /sys/include/ape/x
=C2=A0 =C2=A0 #else
=C2=A0 =C2=A0 #define SYS_PATH(x) sys_#= #x
=C2=A0 =C2=A0 #endif
=C2=A0 =C2=A0 #define SYSINCLUD= E(x) <SYS_PATH(x)>

string.h:
=C2= =A0 =C2=A0 #include SYSINCLUDE(string.h)

sys_strin= g.h:
=C2=A0 =C2=A0 #include_next <string.h>

<= /div>
This works but I think this way is not good because developer sho= uld manage two files.
Is there any good way?
--0000000000001325ea057288d7ae--