Skip to content

Commit

Permalink
POSIX.xs: avoid "defined but not used" warning
Browse files Browse the repository at this point in the history
The static function not_here() is used for any methods that aren't
implemented. On Linux at least, *all* methods are implemented, so you get:

POSIX.xs:1639:1: warning: ‘not_here’ defined but not used [-Wunused-function]
 not_here(const char *s)

Ensure at least one use of this function to avoid that warning.
A bit hacky, but I couldn't think of a better way.
  • Loading branch information
iabyn committed Jun 13, 2016
1 parent 81b22c1 commit 706d6f2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ext/POSIX/POSIX.xs
Original file line number Diff line number Diff line change
Expand Up @@ -1663,6 +1663,11 @@ allocate_struct(pTHX_ SV *rv, const STRLEN size, const char *packname) {
SV *const t = newSVrv(rv, packname);
void *const p = sv_grow(t, size + 1);

/* Ensure at least one use of not_here() to avoid "defined but not
* used" warning. This is not at all related to allocate_struct(); I
* just needed somewhere to dump it - DAPM */
if (0) { not_here(""); }

SvCUR_set(t, size);
SvPOK_on(t);
return p;
Expand Down

0 comments on commit 706d6f2

Please sign in to comment.