Skip to content

Commit

Permalink
fix: attempt fix for compiler error on Linux
Browse files Browse the repository at this point in the history
    xmap.c: In function ‘commandt_xmap’:
    xmap.c:18:9: error: ‘MAP_ANONYMOUS’ undeclared (first use in this function)
       18 |         MAP_ANONYMOUS | MAP_NORESERVE | MAP_PRIVATE,
          |         ^~~~~~~~~~~~~
    xmap.c:18:9: note: each undeclared identifier is reported only once for each function it appears in
    xmap.c:18:25: error: ‘MAP_NORESERVE’ undeclared (first use in this function)
       18 |         MAP_ANONYMOUS | MAP_NORESERVE | MAP_PRIVATE,
          |                         ^~~~~~~~~~~~~

GNU extensions, apparently, and when I was using Clang default target
(gnu17) I wasn't seeing this (and on Linux/GCC, not sure what the
default is, but it wasn't needed).
  • Loading branch information
wincent committed Aug 17, 2024
1 parent 3ff3e4e commit c8ea7c9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lua/wincent/commandt/lib/xmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

#include "xmap.h"

#define _GNU_SOURCE /* for MAP_ANONYMOUS, MAP_NORESERVE */

#include <assert.h> /* for assert() */
#include <stddef.h> /* for NULL */
#include <stdlib.h> /* for abort() */
Expand Down

0 comments on commit c8ea7c9

Please sign in to comment.