From 41ed905f57ec62162aac5be5bd5551b7b753e88d Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Wed, 14 Dec 2016 14:44:25 +0100 Subject: Added warning for inline asm in sdump. Bug 20593 --- cparser/Cerrors.ml | 6 ++++++ cparser/Cerrors.mli | 1 + powerpc/AsmToJSON.ml | 7 ++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/cparser/Cerrors.ml b/cparser/Cerrors.ml index 562d8e89..612980f1 100644 --- a/cparser/Cerrors.ml +++ b/cparser/Cerrors.ml @@ -71,6 +71,7 @@ type warning_type = | Literal_range | Unknown_pragmas | CompCert_conformance + | Inline_asm_sdump let active_warnings: warning_type list ref = ref [ Unnamed; @@ -89,6 +90,7 @@ let active_warnings: warning_type list ref = ref [ Invalid_noreturn; Return_type; Literal_range; + Inline_asm_sdump; ] let error_warnings: warning_type list ref = ref [] @@ -113,6 +115,7 @@ let string_of_warning = function | Literal_range -> "literal-range" | Unknown_pragmas -> "unknown-pragmas" | CompCert_conformance -> "compcert-conformance" + | Inline_asm_sdump -> "inline-asm-sdump" let activate_warning w () = if not (List.mem w !active_warnings) then @@ -151,6 +154,7 @@ let wall () = Literal_range; Unknown_pragmas; CompCert_conformance; + Inline_asm_sdump; ] let werror () = @@ -173,6 +177,7 @@ let werror () = Return_type; Literal_range; Unknown_pragmas; + Inline_asm_sdump; ] @@ -294,6 +299,7 @@ let warning_options = error_option Literal_range @ error_option Unknown_pragmas @ error_option CompCert_conformance @ + error_option Inline_asm_sdump @ [Exact ("-Wfatal-errors"), Set error_fatal; Exact ("-fdiagnostics-color"), Ignore; (* Either output supports it or no color *) Exact ("-fno-diagnostics-color"), Unset color_diagnostics; diff --git a/cparser/Cerrors.mli b/cparser/Cerrors.mli index 56894c87..8501cfa0 100644 --- a/cparser/Cerrors.mli +++ b/cparser/Cerrors.mli @@ -44,6 +44,7 @@ type warning_type = | Literal_range (** literal ranges *) | Unknown_pragmas (** unknown/unsupported pragma *) | CompCert_conformance (** features that are not part of the CompCert C core language *) + | Inline_asm_sdump (** inline assembler used in combination of sdump *) val warning : (string * int) -> warning_type -> ('a, Format.formatter, unit, unit, unit, unit) format6 -> 'a (** [warning (f,c) w fmt arg1 ... argN] formats the arguments [arg1] to [argN] as warining according to diff --git a/powerpc/AsmToJSON.ml b/powerpc/AsmToJSON.ml index f0000035..5304b967 100644 --- a/powerpc/AsmToJSON.ml +++ b/powerpc/AsmToJSON.ml @@ -264,7 +264,12 @@ let p_instruction oc ic = | Pxori (ir1,ir2,c) ->instruction "Pxori" [Ireg ir1; Ireg ir2; Constant c] | Pxoris (ir1,ir2,c) -> instruction "Pxoris" [Ireg ir1; Ireg ir2; Constant c] | Plabel l -> instruction "Plabel" [ALabel l] - | Pbuiltin _ -> () + | Pbuiltin (ef,_,_) -> + begin match ef with + | EF_inline_asm _ -> + Cerrors.warning ("",-10) Cerrors.Inline_asm_sdump "inline assembler is not supported in sdump" + | _ -> () + end | Pcfi_adjust _ (* Only debug relevant *) | Pcfi_rel_offset _ -> () (* Only debug relevant *) in List.iter instruction ic -- cgit