[Bug 720100] New: redefinition of malloc - old grammar.y bugs crawl out of the woodwork

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Mon Dec 9 04:14:26 PST 2013


https://bugzilla.gnome.org/show_bug.cgi?id=720100
  GStreamer | gstreamer (core) | git

           Summary: redefinition of malloc - old grammar.y bugs crawl out
                    of the woodwork
    Classification: Platform
           Product: GStreamer
           Version: git
        OS/Version: Windows
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: gstreamer (core)
        AssignedTo: gstreamer-bugs at lists.freedesktop.org
        ReportedBy: lrn1986 at gmail.com
         QAContact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---


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

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list