Bug 210938 - devel/gmake: make-4.2.1/glob/glob.c could use 4 (char*) casts, one per example realloc that is currently given char** first arguments
Summary: devel/gmake: make-4.2.1/glob/glob.c could use 4 (char*) casts, one per exampl...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Tijl Coosemans
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-09 08:56 UTC by Mark Millard
Modified: 2018-02-20 09:45 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (tijl)


Attachments
patch (266 bytes, patch)
2018-01-16 14:14 UTC, Tijl Coosemans
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Millard 2016-07-09 08:56:05 UTC
Just to get rid of misleading compiler warnings I recommend explicit (char*) casts be added to avoid:

glob.c:818:27: warning: incompatible pointer types passing 'char **' to parameter of type 'char *'; dereference with * [-Wincompatible-pointer-types]
            = (char **) realloc (pglob->gl_pathv,
                                 ^~~~~~~~~~~~~~~
                                 *
glob.c:937:24: warning: incompatible pointer types passing 'char **' to parameter of type 'char *'; dereference with * [-Wincompatible-pointer-types]
                = (char **) realloc (pglob->gl_pathv,
                                     ^~~~~~~~~~~~~~~
                                     *
glob.c:992:39: warning: incompatible pointer types passing 'char **' to parameter of type 'char *'; dereference with * [-Wincompatible-pointer-types]
              new_pathv = (char **) realloc (pglob->gl_pathv,
                                             ^~~~~~~~~~~~~~~
                                             *
glob.c:1383:23: warning: incompatible pointer types passing 'char **' to parameter of type 'char *'; dereference with * [-Wincompatible-pointer-types]
        = (char **) realloc (pglob->gl_pathv,
                             ^~~~~~~~~~~~~~~
                             *


So, for example,

            = (char **) realloc ((char*) pglob->gl_pathv,

The compiler's suggested change is definitely wrong here and could be confusing.
Comment 1 Mark Millard 2016-08-02 08:49:52 UTC
The build was of gmake-4.2.1_1 --which is still in place as of /usr/ports/ -r419343 .
Comment 2 Walter Schwarzenfeld freebsd_triage 2018-01-12 11:35:39 UTC
Maintainer feedback?
Comment 3 Tijl Coosemans freebsd_committer 2018-01-16 14:14:51 UTC
Created attachment 189795 [details]
patch

Because this isn't important and because changes to this port require an exp-run I'll include this patch in the next bigger update.
Comment 4 Walter Schwarzenfeld freebsd_triage 2018-01-16 14:20:31 UTC
Ok, thanks for reply.
Comment 5 commit-hook freebsd_committer 2018-02-20 09:39:33 UTC
A commit references this bug:

Author: tijl
Date: Tue Feb 20 09:39:15 UTC 2018
New revision: 462385
URL: https://svnweb.freebsd.org/changeset/ports/462385

Log:
  - Remove fmake hack because FreeBSD 9 is EoL.
  - Fix compiler warning about realloc. [1]
  - Remove dependency on gettext-tools and iconv. [2]
  - Add upstream patch to fix hangs when doing parallel builds. [3]

  PR:		210938 [1], 212157 [2], 225899 [3]
  Obtained from:	https://git.savannah.gnu.org/cgit/make.git/commit/?id=b552b05251980f693c729e251f93f5225b400714 [3]
  Exp-run by:	antoine, truckman

Changes:
  head/devel/gmake/Makefile
  head/devel/gmake/files/patch-glob-glob.c
  head/devel/gmake/files/patch-posixos.c