public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Dmitry Golovin <dima@golovin.in>
To: Ulf Hermann <ulf.hermann@qt.io>,
	"elfutils-devel@sourceware.org" <elfutils-devel@sourceware.org>
Subject: Re: Compile elfutils with Clang
Date: Tue, 12 Sep 2017 15:25:00 -0000	[thread overview]
Message-ID: <340011505229931@web28j.yandex.ru> (raw)
In-Reply-To: <11f1add3-ef1b-437e-5e85-09d6f9b2d47c@qt.io>

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

Hi Ulf,

Forgot to include it. I believe this file was also written by Chih-hung.

Regards,
Dmitry

12.09.2017, 17:32, "Ulf Hermann" <ulf.hermann@qt.io>:
> Hi Dmitry,
>
> I would love to know how you implemented INLINE_NESTED_FUNC, but nested_func.h seems to be missing from your patch. Can you please double check this?
>
> regards,
> Ulf

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: nested_func.h --]
[-- Type: text/x-c; name="nested_func.h", Size: 2769 bytes --]

/* Copyright (C) 2015 Red Hat, Inc.
   This file is part of elfutils.
   Written by Chih-Hung Hsieh <chh(a)google.com>, 2015.

   This file is free software; you can redistribute it and/or modify
   it under the terms of either

     * the GNU Lesser General Public License as published by the Free
       Software Foundation; either version 3 of the License, or (at
       your option) any later version

   or

     * the GNU General Public License as published by the Free
       Software Foundation; either version 2 of the License, or (at
       your option) any later version

   or both in parallel, as here.

   elfutils is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.

   You should have received copies of the GNU General Public License and
   the GNU Lesser General Public License along with this program.  If
   not, see <http://www.gnu.org/licenses/>.  */

#ifndef _NESTED_FUNC_H
#define _NESTED_FUNC_H 1

#if __clang__

  #define __BLOCK __block

  #define NESTED_FUNC(return_type, function_name, \
                      arg_types, arg_types_and_names) \
    return_type (^function_name) arg_types = \
        ^ return_type arg_types_and_names

  /* Clang does not like inline keyword before a block variable. */
  #define INLINE_NESTED_FUNC(r, f, t, a) \
    NESTED_FUNC (r, f, t, a)

  #define INLINE_INTUSE_NESTED_FUNC(r, f, t, a) \
    NESTED_FUNC (r, INTUSE(f), t, a)

  /* Recrusive blocks need to be declared before used. */
  #define RECURSIVE_NESTED_FUNC(return_type, function_name, \
                      arg_types, arg_types_and_names) \
    __BLOCK return_type (^function_name) arg_types; \
    function_name = ^ return_type arg_types_and_names

  #define INLINE_RECURSIVE_NESTED_FUNC(r, f, t, a) \
    RECURSIVE_NESTED_FUNC (r, f, t, a)

  #define INLINE_INTUSE_RECURSIVE_NESTED_FUNC(r, f, t, a) \
    RECURSIVE_NESTED_FUNC (r, INTUSE(f), t, a)

#else /* gcc nested function */

  #define __BLOCK

  #define NESTED_FUNC(return_type, function_name, \
                      arg_types, arg_types_and_names) \
    return_type function_name arg_types_and_names

  #define INLINE_NESTED_FUNC(r, f, t, a) \
    inline NESTED_FUNC (r, f, t, a)

  #define INLINE_INTUSE_NESTED_FUNC(r, f, t, a) \
    inline NESTED_FUNC (r, INTUSE(f), t, a)

  #define RECURSIVE_NESTED_FUNC(r, f, t, a) \
    NESTED_FUNC (r, f, t, a)

  #define INLINE_RECURSIVE_NESTED_FUNC(r, f, t, a) \
    inline RECURSIVE_NESTED_FUNC (r, f, t, a)

  #define INLINE_INTUSE_RECURSIVE_NESTED_FUNC(r, f, t, a) \
    INLINE_RECURSIVE_NESTED_FUNC (r, INTUSE(f), t, a)

#endif

#endif /* _NESTED_FUNC_H */

  reply	other threads:[~2017-09-12 15:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-09 10:53 Dmitry Golovin
     [not found] ` <CAEk9T_1jS-JmN6Ef+5ncsGodgK4oT7FwAu9C5PZCgoPJFPhcNg@mail.gmail.com>
2017-09-12 13:09   ` Dmitry Golovin
2017-09-12 14:32     ` Ulf Hermann
2017-09-12 15:25       ` Dmitry Golovin [this message]
2017-09-19 14:27 ` Mark Wielaard

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=340011505229931@web28j.yandex.ru \
    --to=dima@golovin.in \
    --cc=elfutils-devel@sourceware.org \
    --cc=ulf.hermann@qt.io \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).