git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Do not make trace.c/getnanotime an inlined function

From
Johannes Sixt <j6t@kdbg.org>
Date
Sep 28, 2014, 19:15 UTC
Message-ID
<54285E51.3090209@kdbg.org>
In-Reply-To
<1411890626-28237-1-git-send-email-bdwalton@gmail.com>
Am 28.09.2014 um 09:50 schrieb Ben Walton:
Show 24 quoted lines
> Oracle Studio compilers don't allow for static variables in functions
> that are defined to be inline. GNU C does permit this. Let's reference
> the C99 standard though, which doesn't allow for inline functions to
> contain modifiable static variables.
> 
> Signed-off-by: Ben Walton <bdwalton@gmail.com>
> ---
>  trace.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/trace.c b/trace.c
> index b6f25a2..4778608 100644
> --- a/trace.c
> +++ b/trace.c
> @@ -385,7 +385,7 @@ static inline uint64_t gettimeofday_nanos(void)
>   * Returns nanoseconds since the epoch (01/01/1970), for performance tracing
>   * (i.e. favoring high precision over wall clock time accuracy).
>   */
> -inline uint64_t getnanotime(void)
> +uint64_t getnanotime(void)
>  {
>  	static uint64_t offset;
>  	if (offset > 1) {
> 
But then the function could stay static, no?
-- Hannes
Previous: Ben WaltonNext: Duy Nguyen
Message 2 of 7 in “Do not make trace.c/getnanotime an inlined function”
  1. Do not make trace.c/getnanotime an inlined functionBen Walton, Sep 28, 2014
  2. Johannes SixtSep 28, 2014
  3. Duy NguyenSep 29, 2014
  4. Junio C HamanoSep 29, 2014
  5. Duy NguyenSep 30, 2014
  6. Junio C HamanoSep 30, 2014
  7. Johannes SixtSep 29, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.