From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id iH8XDm1eEGfrJAEAe85BDQ:P1 (envelope-from ) for ; Thu, 17 Oct 2024 02:46:37 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id iH8XDm1eEGfrJAEAe85BDQ (envelope-from ) for ; Thu, 17 Oct 2024 02:46:37 +0200 X-Envelope-To: patches@johnnyrichard.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=O1jtTBnz; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=LLbPWdGN; dmarc=pass (policy=none) header.from=maniero.me; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht; arc=pass ("mailchannels.net:s=arc-2022:i=1") ARC-Seal: i=2; s=key1; d=johnnyrichard.com; t=1729125997; a=rsa-sha256; cv=pass; b=EjKn2CaY89AYCGvFvFDK9hB3d25DUGuBvyszjweo9t8C1vYBWMeYkOWFKkBa9tVPfCHTjx 2S4D+oGPQPpeZAkaRn8HQn2U1CIk+Qj97vuQHSJ6eimo2kG6yElYt3Uk3AM+s+YYvZeLJI XP6SLVFG5NXvsOiGzMDrx59ZUoGJWmVGYvDsR3XsspBzJdoampViYL5FHEEsza7spR7U2r dYqLBUbGQ8bEW0901/ck6nP0cVNbAax51/WLLCZnofE1ieJZaynVXMw2SXx+tHByN8ggEE LRC6+mZuCXExirjJRiyEzpB2bpTjuwR5+IIAA9mHgxHr3munTAm8BG/s5A4ZQQ== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=O1jtTBnz; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=LLbPWdGN; dmarc=pass (policy=none) header.from=maniero.me; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht; arc=pass ("mailchannels.net:s=arc-2022:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=johnnyrichard.com; s=key1; t=1729125997; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:list-id: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=utzSEnKMUOwKRGFgF9S8VxIverMJFzblxgfg2niVwHc=; b=gHSUsxvMSLs1Xu3wyQXmOM93WaDUWyV4obkLhHwUE9NOuHxi7p0z2qPZxgLJ2uyBXwsmV4 2UgzMErG8GvOmaV933+h3APBN3+pxiMKopjQuyXZTkJglVDUejbnOxL3VouHTj3gjl+z7f 41RtU3aOE9ZWS55taDsSHb7P/vKfmwJKWeLvJvoTZs8bPaETDtyVYxNzMVwGDm3AGW5vmC cUcAtw7bmi1Te4cq6QdSoZlxuCFbU36xW0fE8ZVFHbQAPhB4nSDTNq1A3doB0/lTldt2oM bylEfxrm2nuU4tBnj6sRuWDxW4tsd6jWDcH+Y9GMW3cdKqVwJfbqvygeK3jVJQ== Received: from mail-a.sr.ht (mail-a.sr.ht [46.23.81.152]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1BD2C635CE for ; Thu, 17 Oct 2024 02:46:36 +0200 (CEST) DKIM-Signature: a=rsa-sha256; bh=m0IkKF5psIyySvetOULGi6t9Ezw0tiZ7yJu22y2v+f4=; c=simple/simple; d=lists.sr.ht; h=From:To:Cc:Subject:Date:List-Unsubscribe:List-Subscribe:List-Archive:List-Post:List-ID; q=dns/txt; s=20240113; t=1729125996; v=1; b=O1jtTBnzVPQ9HHrXqLWPbMRS9J2G0iHm6BAJc1aQPE6XDQVF3Jcqz7gy5v/cF8ROh8Wsv+wu 3KleFu5xGM+UPmV9rq4n66jI2DSN8hfnu9BOBsZ58eNQH0BScGVnOx9xVpppz9aQJ6oVplxOQ5M g28uNpQ+KrhupyYkiDEKZHSuskjCvffkhsdJdUsdcekak5XjdUZ4t/ifGcPo7bcAXccMrl8JpnU jKqv2KxJ334qXL4FSvCyCenjqYPoCT7m3RN8Jq3cGfdOq5qTyc5UVQOrd0XQ8R8eyw2iAtLig89 jEZJ4gURTLO7krSyqQXdva8kvhfut2NgIjwHJAvUAnxjg== Received: from lists.sr.ht (unknown [46.23.81.154]) by mail-a.sr.ht (Postfix) with ESMTPSA id A6D53202C9 for ; Thu, 17 Oct 2024 00:46:36 +0000 (UTC) Received: from dragonfly.ash.relay.mailchannels.net (dragonfly.ash.relay.mailchannels.net [23.83.222.51]) by mail-a.sr.ht (Postfix) with ESMTPS id 9907E201F7 for <~johnnyrichard/olang-devel@lists.sr.ht>; Thu, 17 Oct 2024 00:46:35 +0000 (UTC) X-Sender-Id: hostingeremail|x-authuser|carlos@maniero.me Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id E45A0825D6 for <~johnnyrichard/olang-devel@lists.sr.ht>; Thu, 17 Oct 2024 00:46:33 +0000 (UTC) Received: from fr-int-smtpout5.hostinger.io (100-99-0-247.trex-nlb.outbound.svc.cluster.local [100.99.0.247]) (Authenticated sender: hostingeremail) by relay.mailchannels.net (Postfix) with ESMTPA id 137AA82508 for <~johnnyrichard/olang-devel@lists.sr.ht>; Thu, 17 Oct 2024 00:46:32 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1729125993; a=rsa-sha256; cv=none; b=H8srv/0GeIlIehlegpRwK+t32MLUg6dIIyDxrvaz2zlmerZMl/Y+Rfjpf3uZeuEHPMv4+T hwxgeEX341QZATuQ74EmCdnVfuVR68x0aUkIH66kQ/PC6Aq/S1wxUKoVX+yBy1Xw70t+LY JtKPofIN9nvsGNSPjD40ez4tbXG8GRv8/Oo/Zq2wv7RWCdzpUkZJ2fx49V2mgJsakAjfbA IsdbgT1YL/7oGNXl7tS9jRGC2WQMsTH6R8UQlXx4i+QY/Nvm7Irs8WkgJWTaJlxF2LI0XZ Ybbrg7PEpKrcuT+0JSOS5CsUQAELu2QwYZWiJseJid+YsCuUXY7Ac7sqE9cWYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1729125993; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:dkim-signature; bh=utzSEnKMUOwKRGFgF9S8VxIverMJFzblxgfg2niVwHc=; b=zZCRz7LArR678m04O93IlV5GUsYOf9BWVHLsn9Xbh3LeOQB/aJ8IBN9MvNuU5wz/Yyuwbe Btt190aILINxIqwQ0h4sJV2XE/aroj8udUx0ea11EkxLpr196VC1RKtpB5jp4dNxTBeStI SWhxp7EwbC5g3jwKwcR3mXy1gs7b5HfgQRK3ZwrJe0vQHy+kPhPdDmLmAOPf6lkmw9byAt FgcD/zTG8Pmi6HjqCnmyrE2KSoIHv5tVYt8NYpfCPf/ln9hlXTX0lVTOQt98l1YKLpvSN+ RsmYFXRpsCVLU+Syx44SrymywQZME75Fo/BosGBt8FOx4V7Dq2QSvyV2CEOXQA== ARC-Authentication-Results: i=1; rspamd-75d86777c9-cbk9m; auth=pass smtp.auth=hostingeremail smtp.mailfrom=carlos@maniero.me X-Sender-Id: hostingeremail|x-authuser|carlos@maniero.me X-MC-Relay: Neutral X-MailChannels-SenderId: hostingeremail|x-authuser|carlos@maniero.me X-MailChannels-Auth-Id: hostingeremail X-Rock-Coil: 38c935b85074763d_1729125993726_127801857 X-MC-Loop-Signature: 1729125993726:96529902 X-MC-Ingress-Time: 1729125993725 Received: from fr-int-smtpout5.hostinger.io (fr-int-smtpout5.hostinger.io [89.116.146.168]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.99.0.247 (trex/7.0.2); Thu, 17 Oct 2024 00:46:33 +0000 From: Carlos Maniero DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maniero.me; s=hostingermail1; t=1729125990; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=utzSEnKMUOwKRGFgF9S8VxIverMJFzblxgfg2niVwHc=; b=LLbPWdGNplt1F6jAGtDwGq3PK0amSbJgqUJzCGOoLqTRG4vi0aj8Dlv8r0OZcn/XuyCtTv 6VwMYbAVdPCzZmXAtHZ2Fvc7OjATjXq0zckszCOjIXZCgocWRkUAEgjYNX50m37//xOyQZ 4pIo2RwwJZEcnfUEY4vywdJmUNhB9oAFRg4Y09BIvBNgdseqUoQoNIrfw43sa+vBnEh5q0 40n5pOb82Q2PC0FW3i++2HMpN3cFj3Tn+/BvPhOtKpidLWSf4Kd0Lt4DzPfcLoX7gKTe/b FOg1dRfIdq/wUdG23DotlGUqsRB1A13HDDmyKbyhPIpri6y9XE5+RgIbJ3pKUg== To: ~johnnyrichard/olang-devel@lists.sr.ht Cc: Carlos Maniero Subject: [PATCH olang v1] codegen: allow function call at the block level Message-ID: <20241017004619.294274-1-carlos@maniero.me> X-Mailer: git-send-email 2.46.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Date: Thu, 17 Oct 2024 00:46:27 +0000 (UTC) X-CM-Analysis: v=2.4 cv=Z6G+H2RA c=1 sm=1 tr=0 ts=67105e65 a=WwxFCuf3mf1fs3oSi6/dng==:117 a=WwxFCuf3mf1fs3oSi6/dng==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=12PElAss_uSa0Z8xvHQA:9 a=BXDaF_L80NY05PYiAFlV:22 X-CM-Envelope: MS4xfAaWeLgdVveNSufqW7XpGCsObExUtVpxpvGlAwCJ2t8MYWFPbYcTSgWBOaxVN95SGp0843dp1AXoqe7ZwEINFBSJ+xfrYTU1Gwa2aSxLGmMyBY9GXAQl 18/0SHVNdJlzq2ftgQLsFXYVNQF8s/QqxDI+qZM44/cAjxiPtQAkAXQ6cd8a9YhEG/o65dn+QbtRfm02TYgwnFPjd/anhEclaxWP4Li9qT435HsNWElpEdNP X-AuthUser: carlos@maniero.me X-Sourcehut-Patchset-Status: PROPOSED List-Unsubscribe: List-Subscribe: List-Archive: Archived-At: List-Post: List-ID: ~johnnyrichard/olang-devel <~johnnyrichard/olang-devel.lists.sr.ht> Sender: ~johnnyrichard/olang-devel <~johnnyrichard/olang-devel@lists.sr.ht> X-Migadu-Flow: FLOW_IN X-Migadu-Country: NL X-Migadu-Spam-Score: -0.77 X-Spam-Score: -0.77 X-Migadu-Queue-Id: 1BD2C635CE X-Migadu-Scanner: mx12.migadu.com X-TUID: BXmemUS/K411 The extern test was also renamed to match its intention. Signed-off-by: Carlos Maniero --- src/codegen_x86_64.c | 3 ++- ...037_variable_overflow.ol => 0037_extern_call.ol} | 13 ++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) rename tests/olc/{0037_variable_overflow.ol => 0037_extern_call.ol} (82%) diff --git a/src/codegen_x86_64.c b/src/codegen_x86_64.c index c4cef3c..deb7e24 100644 --- a/src/codegen_x86_64.c +++ b/src/codegen_x86_64.c @@ -745,7 +745,8 @@ codegen_x86_64_emit_block(codegen_x86_64_t *codegen, ast_block_t *block) break; } - case AST_NODE_BINARY_OP: { + case AST_NODE_BINARY_OP: + case AST_NODE_FN_CALL: { codegen_x86_64_emit_expression(codegen, node); break; } diff --git a/tests/olc/0037_variable_overflow.ol b/tests/olc/0037_extern_call.ol similarity index 82% rename from tests/olc/0037_variable_overflow.ol rename to tests/olc/0037_extern_call.ol index be36e77..68fe139 100644 --- a/tests/olc/0037_variable_overflow.ol +++ b/tests/olc/0037_extern_call.ol @@ -16,12 +16,14 @@ extern fn putchar(c: u32): u32 fn main(): u32 { - return putchar(111) + putchar(111) + + return 0 } # TEST test_compile(exit_code=0) # -# TEST test_run_binary(exit_code=111) +# TEST test_run_binary(exit_code=0) # # TEST test_ast WITH # Translation_Unit @@ -29,11 +31,12 @@ fn main(): u32 { # | `-Param_Definition # `-Function_Definition # `-Block +# |-Function_Call +# | `-Literal # `-Return_Statement -# `-Function_Call -# `-Literal +# `-Literal # END # # TEST test_contains_tokens WITH -# ./0037_variable_overflow.ol:16:1: +# ./0037_extern_call.ol:16:1: # END base-commit: 9c38120024f10cbfcedb8525ea7bd6c98d7f7b1e -- 2.46.1