From 1c60f3145098cda92a7bd90ed0fce4bd75a03d1c Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 29 Jan 2018 14:01:12 -0500 Subject: [PATCH 01/18] add compile error for calling naked function --- src/ir.cpp | 9 +++++++++ test/compile_errors.zig | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/ir.cpp b/src/ir.cpp index c8afd27945..f76ed753d5 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -9837,6 +9837,15 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal AstNode *fn_proto_node = fn_entry ? fn_entry->proto_node : nullptr;; + if (fn_type_id->cc == CallingConventionNaked) { + ErrorMsg *msg = ir_add_error(ira, fn_ref, buf_sprintf("unable to call function with naked calling convention")); + if (fn_proto_node) { + add_error_note(ira->codegen, msg, fn_proto_node, buf_sprintf("declared here")); + } + return ira->codegen->builtin_types.entry_invalid; + } + + if (fn_type_id->is_var_args) { if (call_param_count < src_param_count) { ErrorMsg *msg = ir_add_error_node(ira, source_node, diff --git a/test/compile_errors.zig b/test/compile_errors.zig index fe167c472c..3b43205773 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -1,6 +1,16 @@ const tests = @import("tests.zig"); pub fn addCases(cases: &tests.CompileErrorContext) void { + cases.add("calling function with naked calling convention", + \\export fn entry() void { + \\ foo(); + \\} + \\nakedcc fn foo() void { } + , + ".tmp_source.zig:2:5: error: unable to call function with naked calling convention", + ".tmp_source.zig:4:9: note: declared here"); + + cases.add("function with invalid return type", \\export fn foo() boid {} , ".tmp_source.zig:1:17: error: use of undeclared identifier 'boid'"); From 5e9f87c3bd968d6186a3bc1ad9c58c919d49ab15 Mon Sep 17 00:00:00 2001 From: Marc Tiehuis Date: Tue, 30 Jan 2018 17:33:38 +1300 Subject: [PATCH 02/18] Improve documentation styling for mobile devices - No overscrolling on small screens - Font-size is reduced for more content per screen - Tables + Code blocks scroll within a block to avoid page-widenening --- doc/langref.html.in | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/doc/langref.html.in b/doc/langref.html.in index 3a2398ef05..8286ef3cb9 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -36,25 +36,53 @@ code { font-size: 12pt; } - @media screen and (min-width: 28.75em) { + pre > code { + display: block; + overflow: auto; + } + .table-wrapper { + width: 100%; + overflow-y: auto; + } + /* Desktop */ + @media screen and (min-width: 56.25em) { #nav { width: 20em; height: 100%; - overflow-y: scroll; position: fixed; + overflow-y: scroll; left: 0; top: 0; + padding-left: 1em; } #contents { - max-width: 50em; + max-width: 60em; padding-left: 22em; + padding: 1em; + padding-left: 24em; + } + .page-title { + /* half-size since h1 */ + padding-left: 12em; + margin-bottom: 2em; + } + } + /* Mobile */ + @media screen and (max-width: 56.25em) { + body, code { + font-size: small; + } + #nav { + border-bottom: 1px solid grey; } } +

Zig Documentation

{#header_open|Introduction#} @@ -173,6 +201,7 @@ pub fn main() %void { } {#code_end#} {#header_open|Primitive Types#} +
@@ -398,9 +427,11 @@ pub fn main() %void { an error code
+
{#see_also|Integers|Floats|void|Errors#} {#header_close#} {#header_open|Primitive Values#} +
@@ -427,6 +458,7 @@ pub fn main() %void { refers to the thing in immediate scope
+
{#see_also|Nullables|this#} {#header_close#} {#header_open|String Literals#} @@ -451,6 +483,7 @@ test "string literals" { {#code_end#} {#see_also|Arrays|Zig Test#} {#header_open|Escape Sequences#} +
@@ -497,6 +530,7 @@ test "string literals" { hexadecimal 24-bit Unicode character code UTF-8 encoded (6 digits)
+

Note that the maximum valid Unicode point is 0x10ffff.

{#header_close#} {#header_open|Multiline String Literals#} @@ -674,6 +708,7 @@ pub fn main() %void { {#header_close#} {#header_open|Operators#} {#header_open|Table of Operators#} +
@@ -1246,6 +1281,7 @@ const ptr = &x;
+
{#header_close#} {#header_open|Precedence#}
x() x[] x.y

From 7eea20bc50bd769b78dc74ded1257733814e8254 Mon Sep 17 00:00:00 2001
From: Andrea Orru 
Date: Mon, 29 Jan 2018 21:02:57 -0800
Subject: [PATCH 03/18] Add IntrusiveLinkedList to index.zig

---
 std/index.zig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/std/index.zig b/std/index.zig
index 3986063068..b5a80cba23 100644
--- a/std/index.zig
+++ b/std/index.zig
@@ -6,6 +6,7 @@ pub const Buffer = @import("buffer.zig").Buffer;
 pub const BufferOutStream = @import("buffer.zig").BufferOutStream;
 pub const HashMap = @import("hash_map.zig").HashMap;
 pub const LinkedList = @import("linked_list.zig").LinkedList;
+pub const IntrusiveLinkedList = @import("linked_list.zig").IntrusiveLinkedList;
 
 pub const base64 = @import("base64.zig");
 pub const build = @import("build.zig");

From 0995a81b8b59b627654ecbf55fa86cd8e98161c6 Mon Sep 17 00:00:00 2001
From: Andrew Kelley 
Date: Tue, 30 Jan 2018 10:31:01 -0500
Subject: [PATCH 04/18] langref: remove page title header

---
 doc/langref.html.in | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/doc/langref.html.in b/doc/langref.html.in
index 8286ef3cb9..bd3fb41340 100644
--- a/doc/langref.html.in
+++ b/doc/langref.html.in
@@ -61,11 +61,6 @@
           padding: 1em;
           padding-left: 24em;
         }
-        .page-title {
-          /* half-size since h1 */
-          padding-left: 12em;
-          margin-bottom: 2em;
-        }
       }
       /* Mobile */
       @media screen and (max-width: 56.25em) {
@@ -79,7 +74,6 @@
     
   
   
-    

Zig Documentation