Hoist argcount() into its own header file

Muffles compiler warnings about unused function.
This commit is contained in:
Lassi Kortela 2019-08-09 22:08:44 +03:00
parent 2610213b42
commit 99feb308bd
7 changed files with 16 additions and 7 deletions

6
c/argcount.h Normal file
View File

@ -0,0 +1,6 @@
static void argcount(char *fname, uint32_t nargs, uint32_t c)
{
if (__unlikely(nargs != c))
lerrorf(ArgError, "%s: too %s arguments", fname,
nargs < c ? "few" : "many");
}

View File

@ -33,6 +33,8 @@
#include "flisp.h"
#include "argcount.h"
size_t llength(value_t v)
{
size_t n = 0;

View File

@ -62,7 +62,9 @@
#include "ieee754.h"
#include "flisp.h"
#include "opcodes.h"
#include "argcount.h"
static char *builtin_names[] = {
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@ -924,7 +926,6 @@ no_kw:
return nargs;
}
#if defined(__amd64__) || defined(_M_AMD64)
#define ARCH_X86_64
#define __CPU__ 686

View File

@ -201,12 +201,6 @@ void bounds_error(char *fname, value_t arr, value_t ind)
__attribute__((__noreturn__));
extern value_t ArgError, IOError, KeyError, MemoryError, EnumerationError;
extern value_t UnboundError;
static void argcount(char *fname, uint32_t nargs, uint32_t c)
{
if (__unlikely(nargs != c))
lerrorf(ArgError, "%s: too %s arguments", fname,
nargs < c ? "few" : "many");
}
struct cvtable {
void (*print)(value_t self, struct ios *f);

View File

@ -23,6 +23,8 @@
#include "flisp.h"
#include "argcount.h"
static value_t iostreamsym, rdsym, wrsym, apsym, crsym, truncsym;
static value_t instrsym, outstrsym;
struct fltype *iostreamtype;

View File

@ -32,6 +32,8 @@
#include "flisp.h"
#include "argcount.h"
value_t fl_stringp(value_t *args, uint32_t nargs)
{
argcount("string?", nargs, 1);

View File

@ -22,6 +22,8 @@
#include "llt.h"
#include "flisp.h"
#include "argcount.h"
#include "equalhash.h"
static value_t tablesym;