Linux-Sparse Archive on lore.kernel.org
 help / color / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 4/9] arch: add predefines __INT_LEAST${N}_TYPE__
Date: Tue, 14 Jul 2020 00:32:58 +0200
Message-ID: <20200713223304.83666-5-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20200713223304.83666-1-luc.vanoostenryck@gmail.com>

These are used by some system headers (neon on arm64).

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 predefine.c  | 9 +++++++++
 target-x86.c | 2 ++
 target.c     | 8 ++++++++
 target.h     | 8 ++++++++
 4 files changed, 27 insertions(+)

diff --git a/predefine.c b/predefine.c
index 94952e81d1df..062e754bf20f 100644
--- a/predefine.c
+++ b/predefine.c
@@ -145,6 +145,15 @@ void predefined_macros(void)
 	predefined_ctype("INT64",      int64_ctype, PTYPE_MAX|PTYPE_TYPE);
 	predefined_ctype("UINT64",    uint64_ctype, PTYPE_MAX|PTYPE_TYPE);
 
+	predefined_ctype("INT_LEAST8",   &schar_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH);
+	predefined_ctype("UINT_LEAST8",  &uchar_ctype, PTYPE_MAX|PTYPE_TYPE);
+	predefined_ctype("INT_LEAST16",  &short_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH);
+	predefined_ctype("UINT_LEAST16",&ushort_ctype, PTYPE_MAX|PTYPE_TYPE);
+	predefined_ctype("INT_LEAST32",   int32_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH);
+	predefined_ctype("UINT_LEAST32", uint32_ctype, PTYPE_MAX|PTYPE_TYPE);
+	predefined_ctype("INT_LEAST64",   int64_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH);
+	predefined_ctype("UINT_LEAST64", uint64_ctype, PTYPE_MAX|PTYPE_TYPE);
+
 	predefined_ctype("INTMAX",    intmax_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH);
 	predefined_ctype("UINTMAX",  uintmax_ctype, PTYPE_MAX|PTYPE_TYPE);
 	predefined_ctype("INTPTR",   ssize_t_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH);
diff --git a/target-x86.c b/target-x86.c
index 62323aecc52b..956af92efe4e 100644
--- a/target-x86.c
+++ b/target-x86.c
@@ -82,6 +82,8 @@ static void init_x86_64(const struct target *target)
 		uint64_ctype = &ullong_ctype;
 		intmax_ctype = &llong_ctype;
 		uintmax_ctype = &ullong_ctype;
+		least64_ctype = &long_ctype;
+		uleast64_ctype = &ulong_ctype;
 		break;
 	}
 }
diff --git a/target.c b/target.c
index cbb25724ae09..e2eb78e25328 100644
--- a/target.c
+++ b/target.c
@@ -15,6 +15,14 @@ struct symbol *int32_ctype = &int_ctype;
 struct symbol *uint32_ctype = &uint_ctype;
 struct symbol *wchar_ctype = &int_ctype;
 struct symbol *wint_ctype = &uint_ctype;
+struct symbol *least8_ctype = &schar_ctype;
+struct symbol *uleast8_ctype = &uchar_ctype;
+struct symbol *least16_ctype = &short_ctype;
+struct symbol *uleast16_ctype = &ushort_ctype;
+struct symbol *least32_ctype = &int_ctype;
+struct symbol *uleast32_ctype = &uint_ctype;
+struct symbol *least64_ctype = &llong_ctype;
+struct symbol *uleast64_ctype = &ullong_ctype;
 
 /*
  * For "__attribute__((aligned))"
diff --git a/target.h b/target.h
index fdf311297237..4140b77c4beb 100644
--- a/target.h
+++ b/target.h
@@ -13,6 +13,14 @@ extern struct symbol *int32_ctype;
 extern struct symbol *uint32_ctype;
 extern struct symbol *wchar_ctype;
 extern struct symbol *wint_ctype;
+extern struct symbol *least8_ctype;
+extern struct symbol *uleast8_ctype;
+extern struct symbol *least16_ctype;
+extern struct symbol *uleast16_ctype;
+extern struct symbol *least32_ctype;
+extern struct symbol *uleast32_ctype;
+extern struct symbol *least64_ctype;
+extern struct symbol *uleast64_ctype;
 
 /*
  * For "__attribute__((aligned))"
-- 
2.27.0


  parent reply index

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-13 22:32 [PATCH 0/9] arch specific predefines Luc Van Oostenryck
2020-07-13 22:32 ` [PATCH 1/9] sparc: add 'sparcv8' predefines for sparc32 Luc Van Oostenryck
2020-07-13 22:32 ` [PATCH 2/9] alpha: has 64-bit long double & int128 Luc Van Oostenryck
2020-07-13 22:32 ` [PATCH 3/9] ppc: add predefines __LONGDOUBLE128 & __LONG_DOUBLE_128__ Luc Van Oostenryck
2020-07-13 22:32 ` Luc Van Oostenryck [this message]
2020-07-13 22:32 ` [PATCH 5/9] arch: add predefines __INT_FAST${N}_TYPE__ Luc Van Oostenryck
2020-07-13 22:33 ` [PATCH 6/9] predefine: teach sparse about __SIG_ATOMIC_TYPE__ Luc Van Oostenryck
2020-07-13 22:33 ` [PATCH 7/9] arch: allow target specific [u]intptr_t & ptrdiff_t Luc Van Oostenryck
2020-07-13 22:33 ` [PATCH 8/9] x86-x32: fix it by defining a separate target for it Luc Van Oostenryck
2020-07-13 22:33 ` [PATCH 9/9] predefine: let predefine_width() take the usual interface Luc Van Oostenryck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200713223304.83666-5-luc.vanoostenryck@gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Sparse Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-sparse/0 linux-sparse/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-sparse linux-sparse/ https://lore.kernel.org/linux-sparse \
		linux-sparse@vger.kernel.org
	public-inbox-index linux-sparse

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-sparse


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git