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] openposix/strncpy1-1: Fix compiler errors/warnings
Date: Fri, 14 Dec 2018 16:40:17 +0800	[thread overview]
Message-ID: <5C136C71.5040104@cn.fujitsu.com> (raw)
In-Reply-To: <20181214083313.GA18691@rei>

On 2018/12/14 16:33, Cyril Hrubis wrote:
> Hi!
>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
>> ---
>>   .../conformance/interfaces/strncpy/1-1.c           |   10 +++++++---
>>   testcases/open_posix_testsuite/include/posixtest.h |    2 ++
>>   2 files changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/testcases/open_posix_testsuite/conformance/interfaces/strncpy/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/strncpy/1-1.c
>> index 396bd60..7006b5f 100644
>> --- a/testcases/open_posix_testsuite/conformance/interfaces/strncpy/1-1.c
>> +++ b/testcases/open_posix_testsuite/conformance/interfaces/strncpy/1-1.c
>> @@ -61,10 +61,14 @@ int main(void)
>>           sample_str_1 = random_string(i);
>>           num_bytes = rand() % i;
>>
>> -        #pragma GCC diagnostic push
>> -        #pragma GCC diagnostic ignored "-Wstringop-truncation"
>> +	#if GCC_VERSION>= 80100
>> +	# pragma GCC diagnostic push
>> +	# pragma GCC diagnostic ignored "-Wstringop-truncation"
>> +	#endif
>>           ret_str = strncpy(sample_str_2, sample_str_1, num_bytes);
>> -        #pragma GCC diagnostic pop
>> +	#if GCC_VERSION>= 80100
>> +	# pragma GCC diagnostic pop
>> +	#endif
> That looks even more silly than the original. I do not think that it's
> reasonable to mess up the code that bad only to surpress a single
> warning.
>
> So what abour removing the pragmas entirely?
>
Hi Cyril,

I didn't get any failure after removing the pragmas on older/newer gcc, 
so i think

we can remove it directly.


Best Regards,
Xiao Yang




      parent reply	other threads:[~2018-12-14  8:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-11  9:30 [LTP] Question about strncpy_2-1 Xiao Yang
2018-12-11  9:59 ` Xiao Yang
2018-12-11 12:37   ` Cyril Hrubis
2018-12-11 12:39 ` Cyril Hrubis
2018-12-12 10:40   ` [LTP] [PATCH] openposix/strncpy1-1: Fix compiler errors/warnings Xiao Yang
2018-12-14  8:33     ` Cyril Hrubis
2018-12-14  8:17       ` [LTP] [PATCH v2] " Xiao Yang
2018-12-14 12:47         ` Cyril Hrubis
2018-12-14  8:40       ` Xiao Yang [this message]

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=5C136C71.5040104@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