9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Kyohei Kadota <lufia@lufia.org>
To: 9fans@9fans.net
Subject: [9fans] question about #include_next directive
Date: Fri,  3 Aug 2018 23:35:21 +0900	[thread overview]
Message-ID: <CAFMepc=tjm3V4VPYzsAWTaHGRcSi3b0C5Z44W8J9oFbhrX5apw@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1300 bytes --]

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 <plan9/crypto.patch
    4. ape/patch -p0 <plan9/ssl.patch
    5. ape/patch -p0 <plan9/apps.patch
    6. for(i in crypto ssl apps/openssl) @{ cd $i; mk }

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

    % cat <<! | cpp
    #if 0
    #include_next <u.h>
    #endif
    !
    #line 1 "/usr/lufia/<stdin>"
    cpp: <stdin>: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) <SYS_PATH(x)>

string.h:
    #include SYSINCLUDE(string.h)

sys_string.h:
    #include_next <string.h>

This works but I think this way is not good because developer should manage
two files.
Is there any good way?

[-- Attachment #2: Type: text/html, Size: 1919 bytes --]

             reply	other threads:[~2018-08-03 14:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-03 14:35 Kyohei Kadota [this message]
2018-08-03 15:19 cinap_lenrek
2018-08-03 18:35 ` Kyohei Kadota
2018-08-03 18:54   ` Lyndon Nerenberg
2018-08-03 19:10   ` Dave MacFarlane
2018-08-03 22:55     ` hiro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFMepc=tjm3V4VPYzsAWTaHGRcSi3b0C5Z44W8J9oFbhrX5apw@mail.gmail.com' \
    --to=lufia@lufia.org \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).