warn about incorrect use of output_*

Signed-off-by: aldot <rep.dot.nop@gmail.com>
mob-stuff
Bernhard Reutner-Fischer 2009-09-01 14:27:41 +02:00 committed by grischka
parent 3a40b44938
commit 8a555345e3
4 changed files with 20 additions and 14 deletions

View File

@ -2212,7 +2212,7 @@ int tcc_add_symbol(TCCState *s, const char *name, void *val)
return 0;
}
int tcc_set_output_type(TCCState *s, int output_type)
int tcc_set_output_type(TCCState *s, output_t output_type)
{
char buf[1024];

View File

@ -61,17 +61,23 @@ LIBTCCAPI int tcc_compile_string(TCCState *s, const char *buf);
/* linking commands */
/* set output type. MUST BE CALLED before any compilation */
#define TCC_OUTPUT_MEMORY 0 /* output will be ran in memory (no
enum output_type_e {
TCC_OUTPUT_MEMORY = 0, /* output will be ran in memory (no
output file) (default) */
#define TCC_OUTPUT_EXE 1 /* executable file */
#define TCC_OUTPUT_DLL 2 /* dynamic library */
#define TCC_OUTPUT_OBJ 3 /* object file */
#define TCC_OUTPUT_PREPROCESS 4 /* preprocessed file (used internally) */
LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type);
TCC_OUTPUT_EXE = 1, /* executable file */
TCC_OUTPUT_DLL = 2, /* dynamic library */
TCC_OUTPUT_OBJ = 3, /* object file */
TCC_OUTPUT_PREPROCESS = 4 /* preprocessed file (used internally) */
};
typedef enum output_type_e output_t;
LIBTCCAPI int tcc_set_output_type(TCCState *s, output_t output_type);
#define TCC_OUTPUT_FORMAT_ELF 0 /* default output format: ELF */
#define TCC_OUTPUT_FORMAT_BINARY 1 /* binary image output */
#define TCC_OUTPUT_FORMAT_COFF 2 /* COFF */
enum output_format_e {
TCC_OUTPUT_FORMAT_ELF = 0, /* default output format: ELF */
TCC_OUTPUT_FORMAT_BINARY = 1, /* binary image output */
TCC_OUTPUT_FORMAT_COFF = 2 /* COFF */
};
typedef enum output_format_e output_format_t;
/* equivalent to -Lpath option */
LIBTCCAPI int tcc_add_library_path(TCCState *s, const char *pathname);

2
tcc.c
View File

@ -69,7 +69,7 @@ static char **files;
static int nb_files, nb_libraries;
static int multiple_files;
static int print_search_dirs;
static int output_type;
static output_t output_type;
static int reloc_output;
static const char *outfile;
static int do_bench = 0;

6
tcc.h
View File

@ -392,8 +392,8 @@ typedef struct ASMOperand {
#endif
struct TCCState {
int output_type;
output_t output_type;
BufferedFile **include_stack_ptr;
int *ifdef_stack_ptr;
@ -454,7 +454,7 @@ struct TCCState {
int has_text_addr;
/* output format, see TCC_OUTPUT_FORMAT_xxx */
int output_format;
output_format_t output_format;
/* C language options */
int char_is_unsigned;