* configure.ac: Do not use GCC 8’s new -Wcast-align flag.
* lib-src/ebrowse.c (xmalloc):
* lib-src/emacsclient.c (xmalloc, xstrdup):
* lib-src/etags.c (xmalloc):
* lib-src/make-docfile.c (xmalloc):
* lib-src/movemail.c (xmalloc):
* src/dispnew.c (new_glyph_pool):
* src/regex.c (xmalloc):
* src/term.c (tty_menu_create):
* src/tparam.h (tparam):
Use ATTRIBUTE_MALLOC. Also see GCC bug 85562.
* lib-src/emacsclient.c (fail):
Do not dereference a null pointer.
* src/frame.c (delete_frame):
Add a decl with UNINIT to work around GCC bug 85563.
* src/menu.h (finish_menu_items):
Do not use attribute const.
* src/regex.c (analyze_first): Use FALLTHROUGH, not a comment.
AS_IF([test $gl_gcc_warnings = yes],
[WERROR_CFLAGS=-Werror])
+ nw="$nw -Wcast-align -Wcast-align=strict" # Emacs is tricky with pointers.
nw="$nw -Wduplicated-branches" # Too many false alarms
nw="$nw -Wformat-overflow=2" # False alarms due to GCC bug 80776
nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings
/* Like malloc but print an error and exit if not enough memory is
available. */
-static void *
+static void * ATTRIBUTE_MALLOC
xmalloc (size_t nbytes)
{
void *p = malloc (nbytes);
\f
/* Like malloc but get fatal error if memory is exhausted. */
-static void *
+static void * ATTRIBUTE_MALLOC
xmalloc (size_t size)
{
void *result = malloc (size);
}
/* Like strdup but get a fatal error if memory is exhausted. */
-char *xstrdup (const char *);
+char *xstrdup (const char *) ATTRIBUTE_MALLOC;
char *
xstrdup (const char *s)
#endif
)
{
- buf = (char *) xmalloc (strlen (pwd) + 1);
+ buf = xmalloc (strlen (pwd) + 1);
strcpy (buf, pwd);
}
else
if (RegOpenKeyEx (predefined, REG_ROOT, 0, KEY_READ, &hrootkey) == ERROR_SUCCESS)
{
- if (RegQueryValueEx (hrootkey, key, NULL, NULL, NULL, &cbData) == ERROR_SUCCESS)
+ if (RegQueryValueEx (hrootkey, key, NULL, NULL, NULL, &cbData)
+ == ERROR_SUCCESS)
{
- result = (char *) xmalloc (cbData);
+ result = xmalloc (cbData);
- if ((RegQueryValueEx (hrootkey, key, NULL, type, (LPBYTE)result, &cbData) != ERROR_SUCCESS)
- || (*result == 0))
+ if ((RegQueryValueEx (hrootkey, key, NULL, type, (LPBYTE) result,
+ &cbData)
+ != ERROR_SUCCESS)
+ || *result == 0)
{
free (result);
result = NULL;
if ((size = ExpandEnvironmentStrings (value, NULL, 0)))
{
- char *buffer = (char *) xmalloc (size);
+ char *buffer = xmalloc (size);
if (ExpandEnvironmentStrings (value, buffer, size))
{
/* Found and expanded. */
{
size_t extra_args_size = (main_argc - optind + 1) * sizeof (char *);
size_t new_argv_size = extra_args_size;
- char **new_argv = NULL;
+ char **new_argv = xmalloc (new_argv_size);
char *s = xstrdup (alternate_editor);
unsigned toks = 0;
static void
quote_argument (HSOCKET s, const char *str)
{
- char *copy = (char *) xmalloc (strlen (str) * 2 + 1);
+ char *copy = xmalloc (strlen (str) * 2 + 1);
const char *p;
char *q;
careful to expand <relpath> with the default directory
corresponding to <drive>. */
{
- char *filename = (char *) xmalloc (MAX_PATH);
+ char *filename = xmalloc (MAX_PATH);
DWORD size;
size = GetFullPathName (argv[i], MAX_PATH, filename, NULL);
}
/* Like malloc but get fatal error if memory is exhausted. */
-static void *
+static void * ATTRIBUTE_MALLOC
xmalloc (size_t size)
{
void *result = malloc (size);
/* Like malloc but get fatal error if memory is exhausted. */
-static void *
+static void * ATTRIBUTE_MALLOC
xmalloc (ptrdiff_t size)
{
void *result = malloc (size);
|| (!defined DISABLE_DIRECT_ACCESS && !defined MAIL_USE_SYSTEM_LOCK))
/* Like malloc but get fatal error if memory is exhausted. */
-static void *
+static void * ATTRIBUTE_MALLOC
xmalloc (size_t size)
{
void *result = malloc (size);
with zeros. If GLYPH_DEBUG and ENABLE_CHECKING are in effect, the global
variable glyph_pool_count is incremented for each pool allocated. */
-static struct glyph_pool *
+static struct glyph_pool * ATTRIBUTE_MALLOC
new_glyph_pool (void)
{
struct glyph_pool *result = xzalloc (sizeof *result);
if (f == sf)
{
Lisp_Object tail;
+ Lisp_Object frame1 UNINIT; /* This line works around GCC bug 85563. */
eassume (CONSP (Vframe_list));
/* Look for another visible frame on the same terminal.
};
extern void init_menu_items (void);
-extern void finish_menu_items (void) ATTRIBUTE_CONST;
+extern void finish_menu_items (void);
extern void discard_menu_items (void);
extern void save_menu_items (void);
extern bool parse_single_submenu (Lisp_Object, Lisp_Object, Lisp_Object);
/* When used in Emacs's lib-src, we need xmalloc and xrealloc. */
-static void *
+static ATTRIBUTE_MALLOC void *
xmalloc (size_t size)
{
void *val = malloc (size);
};
/* Keep `p1' to allow the `on_failure_jump' we are jumping to
to jump back to "just after here". */
- /* Fallthrough */
-
+ FALLTHROUGH;
case on_failure_jump:
case on_failure_keep_string_jump:
case on_failure_jump_nastyloop:
/* Create a brand new menu structure. */
-static tty_menu *
+static tty_menu * ATTRIBUTE_MALLOC
tty_menu_create (void)
{
return xzalloc (sizeof *tty_menu_create ());
char *tgetstr (const char *, char **);
char *tgoto (const char *, int, int);
-char *tparam (const char *, char *, int, int, int, int, int);
+char *tparam (const char *, char *, int, int, int, int, int) ATTRIBUTE_MALLOC;
extern char PC;
extern char *BC;