lkml.org 
[lkml]   [2024]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] selftests: Add _GNU_SOURCE definition when including kselftest_harness.h
On Tue,  7 May 2024 14:35:34 +0800 Tao Su <tao1.su@linux.intel.com> wrote:

> asprintf() is declared in stdio.h when defining _GNU_SOURCE, but stdio.h
> is so common that many files don’t define _GNU_SOURCE before including
> stdio.h, and defining _GNU_SOURCE after including stdio.h will no longer
> take effect.
>
> Since kselftest_harness.h introduces asprintf(), it is necessary to add
> _GNU_SOURCE definition in all selftests including kselftest_harness.h,
> otherwise, there will be warnings or even errors during compilation.
> There are already many selftests that define _GNU_SOURCE or put the
> include of kselftest_harness.h at the very beginning of the .c file, just
> add the _GNU_SOURCE definition in the tests that have compilation warnings.

That asprintf() continues to cause problems. How about we just remove
it? Do the malloc(snprintf(str, 0, ...)) separately?

\
 
 \ /
  Last update: 2024-05-27 18:19    [W:0.400 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site