diff --git a/build_docs.sh b/build_docs.sh index 503cf83ff..e4e614d98 100644 --- a/build_docs.sh +++ b/build_docs.sh @@ -48,13 +48,17 @@ do "./testing/tests/${TARGET}.rs" fi if [ -f "./doc/examples/${EX}/src/x64.rs" ]; then - cp "./doc/examples/${EX}/src/x64.rs" "./testing/tests/${TARGET}_x64.rs" - echo -n -e "#[cfg(target_arch=\"x64\")]\n#[test]\nfn ex_${TARGET}()\n{\n main();\n}\n" >> \ + echo -n -e "#[cfg(target_arch=\"x86_64\")]\nmod test {\n" > \ + "./testing/tests/${TARGET}_x64.rs" + cat "./doc/examples/${EX}/src/x64.rs" >> "./testing/tests/${TARGET}_x64.rs" + echo -n -e "\n#[test]\nfn ex_${TARGET}()\n{\n main();\n}\n}\n" >> \ "./testing/tests/${TARGET}_x64.rs" fi if [ -f "./doc/examples/${EX}/src/aarch64.rs" ]; then - cp "./doc/examples/${EX}/src/aarch64.rs" "./testing/tests/${TARGET}_aarch64.rs" - echo -n -e "#[cfg(target_arch=\"aarch64\")]\n#[test]\nfn ex_${TARGET}()\n{\n main();\n}\n" >> \ + echo -n -e "#[cfg(target_arch=\"aarch64\")]\nmod test {\n" > \ + "./testing/tests/${TARGET}_aarch64.rs" + cat "./doc/examples/${EX}/src/aarch64.rs" >> "./testing/tests/${TARGET}_aarch64.rs" + echo -n -e "\n#[test]\nfn ex_${TARGET}()\n{\n main();\n}\n}\n" >> \ "./testing/tests/${TARGET}_aarch64.rs" fi done diff --git a/plugin/src/directive.rs b/plugin/src/directive.rs index 521a72df7..d58bc1895 100644 --- a/plugin/src/directive.rs +++ b/plugin/src/directive.rs @@ -95,6 +95,12 @@ pub(crate) fn evaluate_directive(invocation_context: &mut DynasmContext, stmts: } } }, + // these are deprecated, but to prevent bad error messages handle them explicitly + // I'd like to provide a warning instead, but proc-macro-error2 emit_warning! seems to not work. + "byte" => emit_error!(directive.span(), "Directive .byte is deprecated, please use .i8 or .u8 instead."), + "word" => emit_error!(directive.span(), "Directive .word is deprecated, please use .i16 or .u16 instead."), + "dword" => emit_error!(directive.span(), "Directive .dword is deprecated, please use .i32 or .u32 instead."), + "qword" => emit_error!(directive.span(), "Directive .qword is deprecated, please use .i64 or .u64 instead."), d => { // unknown directive. skip ahead until we hit a ; so the parser can recover emit_error!(directive, "unknown directive '{}'", d);