aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--compat-bsd.c14
-rw-r--r--compat-solaris.c34
-rw-r--r--evaluate.c9
-rw-r--r--sindex.c7
-rw-r--r--target-ppc.c13
-rw-r--r--target-s390.c13
-rw-r--r--target.h3
-rw-r--r--test-inspect.c2
-rw-r--r--validation/eval/undecl-no-indent.c19
-rwxr-xr-xvalidation/test-suite4
10 files changed, 68 insertions, 50 deletions
diff --git a/compat-bsd.c b/compat-bsd.c
index d8acf40b..43c716ca 100644
--- a/compat-bsd.c
+++ b/compat-bsd.c
@@ -21,16 +21,4 @@
* THE SOFTWARE.
*/
-#include <sys/types.h>
-#include <string.h>
-
-#include "lib.h"
-#include "allocate.h"
-#include "token.h"
-
-#include "compat/mmap-blob.c"
-
-long double string_to_ld(const char *nptr, char **endptr)
-{
- return strtod(nptr, endptr);
-}
+#include "compat-linux.c"
diff --git a/compat-solaris.c b/compat-solaris.c
index 7253a892..58bc4338 100644
--- a/compat-solaris.c
+++ b/compat-solaris.c
@@ -1,33 +1 @@
-#include "lib.h"
-#include "allocate.h"
-
-#include "compat/mmap-blob.c"
-
-#include <floatingpoint.h>
-#include <limits.h>
-#include <errno.h>
-
-long double string_to_ld(const char *str, char **endptr)
-{
- long double res;
- decimal_record dr;
- enum decimal_string_form form;
- decimal_mode dm;
- fp_exception_field_type excp;
- char *echar;
-
- string_to_decimal ((char **)&str, INT_MAX, 0,
- &dr, &form, &echar);
- if (endptr) *endptr = (char *)str;
-
- if (form == invalid_form) {
- errno = EINVAL;
- return 0.0;
- }
-
- dm.rd = fp_nearest;
- decimal_to_quadruple (&res, &dm, &dr, &excp);
- if (excp & ((1 << fp_overflow) | (1 << fp_underflow)))
- errno = ERANGE;
- return res;
-}
+#include "compat-linux.c"
diff --git a/evaluate.c b/evaluate.c
index 461c2547..f515ce6f 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -3130,6 +3130,10 @@ static struct symbol *evaluate_call(struct expression *expr)
if (ctype->type != SYM_FN) {
struct expression *arg;
+
+ if (fn->ctype == &bad_ctype)
+ return NULL;
+
expression_error(expr, "not a function %s",
show_ident(sym->ident));
/* do typechecking in arguments */
@@ -3638,7 +3642,10 @@ static void parse_asm_constraint(struct asm_operand *op)
return;
default:
- // FIXME: arch-specific (and multi-letter) constraints
+ if (arch_target->asm_constraint)
+ str = arch_target->asm_constraint(op, c, str);
+
+ // FIXME: multi-letter constraints
break;
}
}
diff --git a/sindex.c b/sindex.c
index ea092a4a..22836a95 100644
--- a/sindex.c
+++ b/sindex.c
@@ -970,8 +970,8 @@ static int search_query_callback(void *data, int argc, char **argv, char **colna
print_file_line(argv[0], atoi(argv[1]));
fmt++;
break;
- case -1:
-print_string:
+
+ print_string:
if (n) {
printf("%.*s", n, buf);
n = 0;
@@ -979,6 +979,9 @@ print_string:
printf("%s", argv[colnum]);
fmt++;
break;
+ default:
+ break;
+
}
if (pos == fmt)
diff --git a/target-ppc.c b/target-ppc.c
index b138635b..c0d6068f 100644
--- a/target-ppc.c
+++ b/target-ppc.c
@@ -1,6 +1,7 @@
#include "symbol.h"
#include "target.h"
#include "machine.h"
+#include "expression.h"
static void predefine_ppc(const struct target *self)
@@ -15,6 +16,16 @@ static void predefine_ppc(const struct target *self)
predefine("_BIG_ENDIAN", 1, "1");
}
+static const char *asm_constraint_ppc(struct asm_operand *op, int c, const char *str)
+{
+ switch (c) {
+ case 'Z':
+ op->is_memory = true;
+ break;
+ }
+ return str;
+}
+
static void predefine_ppc32(const struct target *self)
{
@@ -32,6 +43,7 @@ const struct target target_ppc32 = {
.target_64bit = &target_ppc64,
.predefine = predefine_ppc32,
+ .asm_constraint = asm_constraint_ppc,
};
@@ -55,4 +67,5 @@ const struct target target_ppc64 = {
.target_32bit = &target_ppc32,
.predefine = predefine_ppc64,
+ .asm_constraint = asm_constraint_ppc,
};
diff --git a/target-s390.c b/target-s390.c
index 8fe7d936..9dbc810e 100644
--- a/target-s390.c
+++ b/target-s390.c
@@ -1,6 +1,7 @@
#include "symbol.h"
#include "target.h"
#include "machine.h"
+#include "expression.h"
static void predefine_s390(const struct target *self)
@@ -8,6 +9,16 @@ static void predefine_s390(const struct target *self)
predefine("__s390__", 1, "1");
}
+static const char *asm_constraint_s390(struct asm_operand *op, int c, const char *str)
+{
+ switch (c) {
+ case 'R': case 'S': case 'T':
+ op->is_memory = true;
+ break;
+ }
+ return str;
+}
+
const struct target target_s390 = {
.mach = MACH_S390,
.bitness = ARCH_LP32,
@@ -21,6 +32,7 @@ const struct target target_s390 = {
.target_64bit = &target_s390x,
.predefine = predefine_s390,
+ .asm_constraint = asm_constraint_s390,
};
@@ -45,4 +57,5 @@ const struct target target_s390x = {
.target_32bit = &target_s390,
.predefine = predefine_s390x,
+ .asm_constraint = asm_constraint_s390,
};
diff --git a/target.h b/target.h
index 8640026c..3ef0d520 100644
--- a/target.h
+++ b/target.h
@@ -53,7 +53,7 @@ extern int pointer_alignment;
extern int bits_in_enum;
extern int enum_alignment;
-
+struct asm_operand;
struct builtin_fn;
struct target {
@@ -77,6 +77,7 @@ struct target {
void (*init)(const struct target *self);
void (*predefine)(const struct target *self);
+ const char *(*asm_constraint)(struct asm_operand *op, int c, const char *str);
};
extern const struct target target_default;
diff --git a/test-inspect.c b/test-inspect.c
index 63754cb3..a59cd902 100644
--- a/test-inspect.c
+++ b/test-inspect.c
@@ -6,6 +6,7 @@
#include <ctype.h>
#include <unistd.h>
#include <fcntl.h>
+#include <locale.h>
#include "lib.h"
#include "allocate.h"
@@ -31,6 +32,7 @@ int main(int argc, char **argv)
struct symbol_list *view_syms = NULL;
gtk_init(&argc,&argv);
+ setlocale(LC_ALL, "C");
expand_symbols(sparse_initialize(argc, argv, &filelist));
FOR_EACH_PTR(filelist, file) {
struct symbol_list *syms = sparse(file);
diff --git a/validation/eval/undecl-no-indent.c b/validation/eval/undecl-no-indent.c
new file mode 100644
index 00000000..4aadf3d9
--- /dev/null
+++ b/validation/eval/undecl-no-indent.c
@@ -0,0 +1,19 @@
+inline void fun(void)
+{
+ undecl();
+}
+
+void foo(void);
+void foo(void)
+{
+ fun();
+ fun();
+}
+
+/*
+ * check-name: undecl-no-indent
+ *
+ * check-error-start
+eval/undecl-no-indent.c:3:9: error: undefined identifier 'undecl'
+ * check-error-end
+ */
diff --git a/validation/test-suite b/validation/test-suite
index d351ebf3..f7d992dc 100755
--- a/validation/test-suite
+++ b/validation/test-suite
@@ -458,6 +458,7 @@ echo "options:"
echo " -a append the created test to the input file"
echo " -f write a test known to fail"
echo " -l write a test for linearized code"
+echo " -p write a test for pre-processing"
echo
echo "argument(s):"
echo " file file containing the test case(s)"
@@ -483,6 +484,9 @@ do_format()
-l)
def_cmd='test-linearize -Wno-decl $file'
linear=1 ;;
+ -p)
+ def_cmd='sparse -E $file' ;;
+
help|-*)
do_format_help
return 0