After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 720100 - parse: redefinition of malloc - old grammar.y bugs crawl out of the woodwork
parse: redefinition of malloc - old grammar.y bugs crawl out of the woodwork
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Windows
: Normal normal
: 1.3.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-12-09 12:14 UTC by LRN
Modified: 2013-12-27 11:56 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description LRN 2013-12-09 12:14:21 UTC
bug 712679 added back the -Werror flag, and now gcc dies on warnings.

Luckily, there's only one source of warnings in grammar.y:
grammar.tab.c:924:7: error: redundant redeclaration of 'malloc' [-Werror=redundant-decls]
 #   define YYMALLOC malloc
       ^
grammar.tab.c:931:6: error: redundant redeclaration of 'free' [-Werror=redundant-decls]
 #   define YYFREE free
      ^

Note that line numbers make no sense. The lines that ARE triggering this:
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
and
void free (void *); /* INFRINGES ON USER NAME SPACE */

These lines are added in a nest of preprocessor commands. Sadly, preprocessor checks for _STDLIB_H to detect stdlib.h, not _STDLIB_H_ (mingw.org) or _INC_STDLIB (mingw-w64). Thus the code (generated by flex, so we can't really fix the check itself) thinks that stdlib.h was not included, and decides to just add prototypes for malloc() and free() (there's a part where it includes stdlib.h and defines _STDLIB_H by itself, but it's C++-only).

How to fix:
Add this to grammar.y after including stdlib.h:
#ifndef _STDLIB_H
# define _STDLIB_H 1
#endif
Comment 1 Sebastian Dröge (slomo) 2013-12-27 11:56:06 UTC
commit c3181fa5df967cc67f3323b20c3cc2f71aff4b03
Author: Sebastian Dröge <sebastian@centricular.com>
Date:   Fri Dec 27 12:55:02 2013 +0100

    parse: Use GLib malloc/free/realloc functions
    
    https://bugzilla.gnome.org/show_bug.cgi?id=720100