public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Xiao Yang <yangx.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 2/2] lib: build check parameters for tst_brk()
Date: Thu, 6 Dec 2018 17:19:32 +0800	[thread overview]
Message-ID: <5C08E9A4.1070604@cn.fujitsu.com> (raw)
In-Reply-To: <CAEemH2f1xJnQV3dt_B1-coRgMRjggPXuHUPQLQq7fsTFkV9GMg@mail.gmail.com>

Hi all,

Sorry, i forgot to reply this mail.  :-(

On 2018/12/06 16:49, Li Wang wrote:
> On Wed, Dec 5, 2018 at 5:25 PM Petr Vorel<pvorel@suse.cz>  wrote:
>> Hi Li, Jan,
>>
>>>>> Alternative would be link time failure, with a symbol name suggesting what went wrong.
>>>> Not sure, how exactly you want to do it, but seems to be more portable than
>>>> requiring specific gcc version (although 4.3 is very old and __attribute__
>>>> format is supported by clang as well).
>>> I took an rough look at the kernel method, maybe we can achieve that
>>> conditionally?
>>> --- a/include/tst_common.h
>>> +++ b/include/tst_common.h
>>> @@ -65,4 +65,23 @@
>>>          ERET;                                                           \
>>>   })
>>> +#define GCC_VERSION (__GNUC__ * 10000          \
>>> +                    + __GNUC_MINOR__ * 100     \
>>> +                    + __GNUC_PATCHLEVEL__)
>>> +
>>> +#if GCC_VERSION>= 40300
>> Didn't you mean reverse?
>> #if GCC_VERSION<  40300
> No, I saw kernel gives this limitation so just use it as that.
> See: https://github.com/torvalds/linux/blob/master/include/linux/build_bug.h#L55
>
>> But this idea does not work for clang, which always use same version:
>> __GNUC__: 4
>> __GNUC_MINOR__: 2
>> __GNUC_PATCHLEVEL__: 1
>> (tested on clang 3.9, 5.0, 6.0)
> Noticed the Travis CI Build #860 works fine with clang, did you config
> anything special for that?  BTW, the remain error part of GCC is not
> the same issue here, see below comments.
>
> Build #860:
> https://travis-ci.org/pevik/ltp/builds/463720369
> https://github.com/pevik/ltp/commit/643bceea36c3447add142fcb5e7a3f79e9ac65a2
>
>> There should be also CLANG_VERSION
>> __clang_major__
>> __clang_minor__
>> __clang_patchlevel__
>>
>> Not sure, which clang version is compiled, even clang 4.0 works well:
>> https://travis-ci.org/pevik/ltp/builds/463734307
>> Maybe we could afford to skip check (searching for __clang__).
> Per GCC compiling error, seems the root cause is tst_brk()
> parameter(tst_test.c: line#355) not using in demanded, isn't that what
> we expected?
I think we should just check invalid type for constants.

> In function ‘check_child_status’,
>      inlined from ‘tst_reap_children’ at tst_test.c:371:4:
> ../include/tst_common.h:74:41: error: call to ‘tst_brk_detect_’
> declared with attribute error: tst_brk(): invalid type, please use
> TBROK/TCONF/TFAIL
>          compiletime_assert(!(cond), msg, tst_brk_detect_)
>                                           ^
> ../include/tst_common.h:79:24: note: in definition of macro ‘compiletime_assert’
>                          funcname_();                            \
>                          ^
> ../include/tst_test.h:74:16: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
>                  BUILD_BUG_ON_MSG(!((ttype)&  (TBROK | TCONF | TFAIL)), \
>                  ^
> tst_test.c:355:3: note: in expansion of macro ‘tst_brk’
>     tst_brk(ret, "Reported by child (%i)", pid);
>     ^
> make[1]: *** [tst_test.o] Error 1
> make[1]: *** Waiting for unfinished jobs....
> make[1]: Leaving directory `/home/travis/build/pevik/ltp/lib'
> make: *** [lib-all] Error 2
>
Perhaps, we need to distinguish between constants and variables by __builtin_constant_p().

Best Regards,
Xiao Yang

> --
> Regards,
> Li Wang
>




  reply	other threads:[~2018-12-06  9:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-08 20:59 [LTP] [PATCH 1/2] syscalls/mq: don't use TWARN with tst_brk() Jan Stancek
2018-11-08 20:59 ` [LTP] [PATCH 2/2] lib: build check parameters for tst_brk() Jan Stancek
2018-11-09  1:56   ` Xiao Yang
2018-11-09 17:57     ` Jan Stancek
2018-12-04 17:35       ` Petr Vorel
2018-12-05  6:34         ` Li Wang
2018-12-05  9:25           ` Petr Vorel
2018-12-06  8:49             ` Li Wang
2018-12-06  9:19               ` Xiao Yang [this message]
2018-12-06 10:15                 ` Li Wang
2018-12-06 10:33               ` Li Wang
2018-12-06 12:59                 ` Petr Vorel
2018-12-06 13:07               ` Petr Vorel
2018-12-07  6:28                 ` Li Wang
2018-12-11 14:58       ` Cyril Hrubis
2019-01-03 11:52         ` Jan Stancek
2019-01-07 18:25           ` Cyril Hrubis
2019-01-07 19:06             ` Jan Stancek
2019-01-07 19:22               ` Cyril Hrubis
2019-01-08 11:14                 ` Jan Stancek
2018-12-04 16:58 ` [LTP] [PATCH 1/2] syscalls/mq: don't use TWARN with tst_brk() Petr Vorel
2018-12-11 14:48 ` Cyril Hrubis

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=5C08E9A4.1070604@cn.fujitsu.com \
    --to=yangx.jy@cn.fujitsu.com \
    --cc=ltp@lists.linux.it \
    /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