projects
/
cparser
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove pointless null pointer check.
[cparser]
/
wrappergen
/
write_jna.c
diff --git
a/wrappergen/write_jna.c
b/wrappergen/write_jna.c
index
189425c
..
f73d8fd
100644
(file)
--- a/
wrappergen/write_jna.c
+++ b/
wrappergen/write_jna.c
@@
-22,6
+22,7
@@
#include <errno.h>
#include <string.h>
#include <errno.h>
#include <string.h>
+#include "adt/strutil.h"
#include "write_jna.h"
#include "symbol_t.h"
#include "ast_t.h"
#include "write_jna.h"
#include "symbol_t.h"
#include "ast_t.h"
@@
-44,11
+45,9
@@
static pset_new_t avoid_symbols;
static output_limit *output_limits;
static const char *libname;
static output_limit *output_limits;
static const char *libname;
-static void write_type(type_t *type);
-
static bool is_system_header(const char *fname)
{
static bool is_system_header(const char *fname)
{
- if (str
ncmp(fname, "/usr/include", 12) == 0
)
+ if (str
start(fname, "/usr/include")
)
return true;
if (fname == builtin_source_position.input_name)
return true;
return true;
if (fname == builtin_source_position.input_name)
return true;
@@
-57,17
+56,17
@@
static bool is_system_header(const char *fname)
static const char *fix_builtin_names(const char *name)
{
static const char *fix_builtin_names(const char *name)
{
- if (str
cmp(name, "class") == 0
) {
+ if (str
eq(name, "class")
) {
return "_class";
return "_class";
- } else if
(strcmp(name, "this") == 0
) {
+ } else if
(streq(name, "this")
) {
return "_this";
return "_this";
- } else if
(strcmp(name, "public") == 0
) {
+ } else if
(streq(name, "public")
) {
return "_public";
return "_public";
- } else if
(strcmp(name, "protected") == 0
) {
+ } else if
(streq(name, "protected")
) {
return "_protected";
return "_protected";
- } else if
(strcmp(name, "private") == 0
) {
+ } else if
(streq(name, "private")
) {
return "_private";
return "_private";
- } else if
(strcmp(name, "final") == 0
) {
+ } else if
(streq(name, "final")
) {
return "_final";
}
/* TODO put all reserved names here */
return "_final";
}
/* TODO put all reserved names here */
@@
-224,16
+223,11
@@
static void write_type(type_t *type)
case TYPE_ENUM:
write_enum_type(&type->enumt);
return;
case TYPE_ENUM:
write_enum_type(&type->enumt);
return;
- case TYPE_BUILTIN:
- write_type(type->builtin.real_type);
- return;
case TYPE_ERROR:
case TYPE_ERROR:
- case TYPE_INVALID:
case TYPE_TYPEOF:
case TYPE_TYPEDEF:
panic("invalid type found");
case TYPE_ARRAY:
case TYPE_TYPEOF:
case TYPE_TYPEDEF:
panic("invalid type found");
case TYPE_ARRAY:
- case TYPE_BITFIELD:
case TYPE_REFERENCE:
case TYPE_FUNCTION:
case TYPE_COMPLEX:
case TYPE_REFERENCE:
case TYPE_FUNCTION:
case TYPE_COMPLEX:
@@
-277,7
+271,7
@@
static void write_unary_expression(const unary_expression_t *expression)
case EXPR_UNARY_NOT:
fputc('!', out);
break;
case EXPR_UNARY_NOT:
fputc('!', out);
break;
- case EXPR_UNARY_CAST
_IMPLICIT
:
+ case EXPR_UNARY_CAST:
write_expression(expression->value);
return;
default:
write_expression(expression->value);
return;
default:
@@
-541,11
+535,13
@@
void write_jna_decls(FILE *output, const translation_unit_t *unit)
const char *input_name = entity->base.source_position.input_name;
if (is_system_header(input_name))
continue;
const char *input_name = entity->base.source_position.input_name;
if (is_system_header(input_name))
continue;
+ if (entity->function.elf_visibility != ELF_VISIBILITY_DEFAULT)
+ continue;
if (output_limits != NULL) {
bool in_limits = false;
for (output_limit *limit = output_limits; limit != NULL;
limit = limit->next) {
if (output_limits != NULL) {
bool in_limits = false;
for (output_limit *limit = output_limits; limit != NULL;
limit = limit->next) {
- if (str
cmp(limit->filename, input_name) == 0
) {
+ if (str
eq(limit->filename, input_name)
) {
in_limits = true;
break;
}
in_limits = true;
break;
}