try to get by with one feature macro

I fucking hate feature macros. Egregious discharge of our
division-of-labor-obsessed society. People should be able to introduce
names. People should be able to give up names to lower levels of
abstraction when they encounter conflicts.

Feature macros seem to exist[1] to support more than two levels of
abstraction. You try to build, one of your libraries fails to build
because of a conflict between it and one level down. You don't want to
modify this library. Just fucking https://catern.com/change_code.html
already. But no, I have to litter my code with feature macros even
though I just want the abstraction the original library provides.

[1] https://man7.org/linux/man-pages/man7/feature_test_macros.7.html
    https://lwn.net/Articles/590381
This commit is contained in:
Kartik K. Agaram 2022-01-29 12:23:24 -08:00
parent 24f0781d2b
commit 7a13adb52c
5 changed files with 1 additions and 11 deletions

View File

@ -8,7 +8,7 @@
PLAT= none
CC= gcc
CFLAGS= -g -O2 -std=c99 -Wall -Wshadow $(MYCFLAGS)
CFLAGS= -g -O2 -std=c99 -Wall -Wshadow $(MYCFLAGS) -D_DEFAULT_SOURCE
AR= ar rc
RANLIB= ranlib
RM= rm -f

View File

@ -32,10 +32,6 @@
#define KILO_VERSION "0.0.1"
#ifdef __linux__
#define _POSIX_C_SOURCE 200809L
#endif
#include <assert.h>
#ifdef __NetBSD__
#include <curses.h>

View File

@ -260,7 +260,6 @@ static StkId tryfuncTM (lua_State *L, StkId func) {
/* based on getfuncname */
extern Instruction symbexec (const Proto *pt, int lastpc, int reg);
extern int luaL_newmetatable (lua_State *L, const char *tname);
extern void endwin (void);
void record_metadata_about_function_call (lua_State *L, CallInfo *ci) {
if (!isLua(ci))
return;

View File

@ -172,7 +172,6 @@ void render_previous_error(void) {
attroff(COLOR_PAIR(COLOR_PAIR_ERROR));
}
extern char* strdup(const char* s);
int report_in_developer_mode(lua_State* L, int status) {
if (status && !lua_isnil(L, -1)) {
Previous_error = strdup(lua_tostring(L, -1)); /* memory leak */
@ -749,8 +748,6 @@ void developer_mode(lua_State* L) {
/* never returns */
}
extern int mkstemp(char* template);
extern FILE* fdopen(int fd, const char* mode);
void save_editor_state(int rowoff, int coloff, int cy, int cx) {
if (strlen(Current_definition) == 0) return;
char outfilename[] = "teliva_editor_state_XXXXXX";

View File

@ -128,8 +128,6 @@ void emit_multiline_string(FILE* out, const char* value) {
}
}
extern int mkstemp(char *template);
extern FILE *fdopen(int fd, const char *mode);
void save_tlv(lua_State* L, char* filename) {
lua_getglobal(L, "teliva_program");
int history_array = lua_gettop(L);