Bug 243546

Summary: devel/elfutils: guard non-standard stdio _unlocked definitions behind #ifndef
Product: Ports & Packages Reporter: Kyle Evans <kevans>
Component: Individual Port(s)Assignee: Kyle Evans <kevans>
Status: Closed FIXED    
Severity: Affects Some People CC: cem, kevans
Priority: --- Flags: cem: maintainer-feedback+
koobs: merge-quarterly?
Version: Latest   
Hardware: Any   
OS: Any   
Description Flags
svn(1) diff against the ports tree
svn(1) diff against the ports tree koobs: maintainer-approval+

Description Kyle Evans freebsd_committer 2020-01-23 15:18:06 UTC
Created attachment 210989 [details]
svn(1) diff against the ports tree

I intend to implement these (and a couple of others) in libc coming soon, so preemptively fix the build by guarding them behind #ifndef so that they work with both old/new.

This part of the patch will likely still be desired for DragonflyBSD compatibility, even after all supported versions have grown the _unlocked variants.

No PORTREVISION bump because it's a big nop until they're actually exposed by libc.
Comment 1 Kyle Evans freebsd_committer 2020-01-23 19:23:09 UTC
Created attachment 210992 [details]
svn(1) diff against the ports tree

Re-roll; just include <stdio.h> before #define'ing the _unlocked variants that will appear in stdio.h shortly, and guard fputc_unlocked on an #ifndef as that one will remain a macro since there's an appropriate inline version.
Comment 2 Conrad Meyer freebsd_committer 2020-01-25 06:44:49 UTC
Whatever you decide is best is ok by me.  You'll need a ports committer to bless the change to commit.
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2020-01-25 12:59:31 UTC
Comment on attachment 210992 [details]
svn(1) diff against the ports tree

If it passes QA:

Reviewed by: koobs (ports)
Approved by: koobs (ports)

If you could, comment the patch header to describe the issue it fixes (this seems like a future 13/CURRENT only issue right?)
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2020-01-25 13:00:31 UTC
^Triage: Re-assign to to Kyle per comment 2 for resolution
Comment 5 Kyle Evans freebsd_committer 2020-01-29 18:12:38 UTC
(In reply to Kubilay Kocak from comment #3)

It would be inappropriate to add a comment to the patch header since this is just modifying the pre-existing patch that adds a good bit of other FreeBSD configuration bits, but I'll add an inline comment near the _unlocked definitions that describes when they can just be removed. =-)
Comment 6 commit-hook freebsd_committer 2020-01-29 18:36:06 UTC
A commit references this bug:

Author: kevans
Date: Wed Jan 29 18:35:30 UTC 2020
New revision: 524564
URL: https://svnweb.freebsd.org/changeset/ports/524564

  devel/elfutils: fix future build failure w.r.t. stdio _unlocked

  Include <stdio.h> early so that the stdio.h function declarations come
  first, then redefine fputs/fwrite/fread_unlocked to the locked versions.
  fputc_unlocked will be a macro similar to putc_unlocked, so just hide that
  one behind an #ifndef since it will be provided as a macro by <stdio.h>. The
  other three will be using the technically-incorrect locked variants until
  all supported releases provide the needed functions, at which point we can
  switch them all at once.

  No PORTREVISION bump as this is just a preemptive build fix that doesn't
  change the output at all.

   * portlint not ran, no change outside of a single patch
   * testport (-CURRENT, amd64; 12.1-RELEASE, amd64; -CURRENT+patch, amd64)

  PR:		243546
  Reviewed by:	koobs (ports)
  Approved by:	koobs (ports), cem (maintainer)
  MFH:		2020Q1 (implicit, build fix)

Comment 7 Kyle Evans freebsd_committer 2020-01-30 14:16:22 UTC
Thanks, Conrad & Koobs!