[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master 7cd8236d35c: Pacify --enable-gcc-warnings with emacs_fdopen
From: |
Po Lu |
Subject: |
Re: master 7cd8236d35c: Pacify --enable-gcc-warnings with emacs_fdopen |
Date: |
Tue, 08 Aug 2023 09:07:59 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Paul Eggert <eggert@cs.ucla.edu> writes:
> branch: master
> commit 7cd8236d35c033fefb7be742e6c3290c63eaf609
> Author: Paul Eggert <eggert@cs.ucla.edu>
> Commit: Paul Eggert <eggert@cs.ucla.edu>
>
> Pacify --enable-gcc-warnings with emacs_fdopen
>
> * src/lisp.h (emacs_fdopen): Now ATTRIBUTE_MALLOC
> ATTRIBUTE_DEALLOC (emacs_fclose, 1), to pacify gcc
> -Wsuggest-attribute=malloc on non-Android platforms.
> ---
> src/lisp.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/lisp.h b/src/lisp.h
> index 447912581d7..85de57b0b2f 100644
> --- a/src/lisp.h
> +++ b/src/lisp.h
> @@ -5086,8 +5086,9 @@ extern int emacs_open (const char *, int, int);
> extern int emacs_open_noquit (const char *, int, int);
> extern int emacs_pipe (int[2]);
> extern int emacs_close (int);
> -extern FILE *emacs_fdopen (int, const char *);
> extern int emacs_fclose (FILE *);
> +extern FILE *emacs_fdopen (int, const char *)
> + ATTRIBUTE_MALLOC ATTRIBUTE_DEALLOC (emacs_fclose, 1);
> extern int emacs_unlink (const char *);
> extern int emacs_symlink (const char *, const char *);
> extern int emacs_rmdir (const char *);
Thanks, but now I receive warnings during the automated daily build of
the Android port:
../../emacs/src/xfaces.c: In function ‘Fx_load_color_file’:
../../emacs/src/xfaces.c:7007:7: warning: ‘emacs_fclose’ called on pointer
returned from a mismatched allocation function [-Wmismatched-dealloc]
7007 | emacs_fclose (fp);
| ^~~~~~~~~~~~~~~~~
../../emacs/src/xfaces.c:6984:8: note: returned from ‘emacs_fopen’
6984 | fp = emacs_fopen (SSDATA (abspath), "r" FOPEN_TEXT);
- Re: master 7cd8236d35c: Pacify --enable-gcc-warnings with emacs_fdopen,
Po Lu <=