From patchwork Tue Jun 11 16:24:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Collin Funk X-Patchwork-Id: 91909 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 19033385DDC4 for ; Tue, 11 Jun 2024 16:25:48 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by sourceware.org (Postfix) with ESMTPS id 69C1C385B510 for ; Tue, 11 Jun 2024 16:25:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 69C1C385B510 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 69C1C385B510 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::102b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718123124; cv=none; b=pjCtwPw78lzSCnPvZvlpP+P7du77HLDx2XVb4K0+G5tGnqSCq+St3VOX6WUuQxu8qDD8Qoj1huFuR262zzToe8Xq4vTexkz8Uzmz1GCSR61/i2ZR3qtr0YRTZEmJNZK6EOsE85ob8kGJAVuatZYsvWLV/PTopiuDehzPn7oQSKg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718123124; c=relaxed/simple; bh=nj2/jUxNppZf9qogvQG7mPFQWY1DpA19NQBUPG+4Uuc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Oz6wkYrpjFESeA4oTj6R155xtqxvKeZPOzNih0ZZe5dDevWcBpG2YsyyN/U9pawMCCuorxhuZdDFQlLuhZiFHERaJvQJ2Mq0vD3gYnfn/2VJQkjshEWClac+7RycvFgVuFULIGrYiKzy3SMxZeEHrAq4EpjcqvEFzvJ3QFqXIJQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-2c2eb5b1917so1170150a91.2 for ; Tue, 11 Jun 2024 09:25:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718123121; x=1718727921; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TJvNvUqhLeNAjlGJWVRa9Y5Vs/rQJHHYuACGYUwxLuA=; b=ip9PQM74XQeRchi9NOktMOP0zaHA2jYcJAMiIRoMfihyczcHfEOT+GrZtayIhx2W0C Z8moU/AzTPqmA3qHy/aFS+RTi8sUn1//66CicmuZcUWRRQ9m9/ZnFXS+KA5y2WyHGhfZ JpWwVYoovjbP468viU/OGXJQRt9xnOPwRUUvMsdKbQdlqjsgxPZARv/3TKGGrfukd9WE 3AmlR1lGsaw/THRBSuRx9PhXHzqceuL8aiRk9fO+O32GyjLWEHm0xt+HReUH+XH9H4dC YSGD9SNqMi7Cekirm2AUjZ4WpLjUu+LBS94iiMwcZhZsbEfZFyIZy+OV+uSiji1P6tUW RZbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718123121; x=1718727921; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TJvNvUqhLeNAjlGJWVRa9Y5Vs/rQJHHYuACGYUwxLuA=; b=F3pgcsg90CytNqf1wKKtpGbWckcov7bwrd5Wbp7x7Y+XmLOK4F3XyDJjBgKrFhRECW mWU3laCkIvcKzTWTyBQGLpkCm8kIqHsMxneaTz6RXkD7t5ZNd33tGEVi7pGSNteswXvb pHvSCnIwHYYWX+2rgxXVFYbH1chs9lpyUv39fnGP0ueDhMW0dDfp0Pt3ZBKi8aH7xqsE eDzsLwk6cC11MX0KgZg32jHDQ9NR27ZfUpjTUYdzF7+InDySUOeRTpjAw9tJMwhm+Jw1 X6plb61PLULz4t5mS1j+qvxCoa1sCAc3q+QDJJIIp9k/9izvbgeA8xGnUlC/zUYtzfel Ztfw== X-Gm-Message-State: AOJu0YxUi2uO5s19lgfPu0PXgPDaNMTTWCLDFSiGve0VBPpEtsEM3tcN 1affNtA8b/URoSC59aQDqU/HruYl1F2Iii9uvXxPECvfSBtKv1JIkRQepA== X-Google-Smtp-Source: AGHT+IHwIMKhzLJSc5jeIpqCQbI3vcJ+PMB456ZWuoNQprqpW85gEvaAcfJd5ULrOLI+YG+VC8XqXQ== X-Received: by 2002:a17:90a:ce92:b0:2c2:c785:63b3 with SMTP id 98e67ed59e1d1-2c2c78565f5mr12273787a91.14.1718123120749; Tue, 11 Jun 2024 09:25:20 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:646:8002:f840::59da]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c307f96471sm4735688a91.52.2024.06.11.09.25.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 09:25:20 -0700 (PDT) From: Collin Funk To: libc-alpha@sourceware.org Cc: josmyers@redhat.com, Collin Funk Subject: [PATCH v2] endian.h: Define unsigned fixed-width integer types [BZ #31749] Date: Tue, 11 Jun 2024 09:24:03 -0700 Message-ID: <20240611162433.413069-1-collin.funk1@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240611084619.1110236-1-collin.funk1@gmail.com> References: <20240611084619.1110236-1-collin.funk1@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org The #ifdef __ASSEMBLER__ is required since sysdeps/unix/sysv/linux/sysdep.h includes which is then included by assembly files. It seems that most assembly uses the pre-defined macros by GCC now so it *could* be removed there. But this method remains compatible with assembly code that assumes can be included like previous versions of glibc. -- 8< -- The upcoming POSIX revision requires that uint16_t, uint32_t, and uint64_t are defined in endian.h. Optionally all symbols from may be defined. This patch includes which defines the required types and uint8_t. This allows glibc to pass Gnulib's checks. Signed-off-by: Collin Funk --- string/endian.h | 15 ++++++++------- string/test-endian-types.c | 1 - 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/string/endian.h b/string/endian.h index fd20a2b198..32001761c8 100644 --- a/string/endian.h +++ b/string/endian.h @@ -23,14 +23,15 @@ /* Get the definitions of __*_ENDIAN, __BYTE_ORDER, and __FLOAT_WORD_ORDER. */ #include -#ifdef __USE_MISC -# define LITTLE_ENDIAN __LITTLE_ENDIAN -# define BIG_ENDIAN __BIG_ENDIAN -# define PDP_ENDIAN __PDP_ENDIAN -# define BYTE_ORDER __BYTE_ORDER -#endif +#define LITTLE_ENDIAN __LITTLE_ENDIAN +#define BIG_ENDIAN __BIG_ENDIAN +#define PDP_ENDIAN __PDP_ENDIAN +#define BYTE_ORDER __BYTE_ORDER + +#ifndef __ASSEMBLER__ +/* Define uintN_t types. */ +# include -#if defined __USE_MISC && !defined __ASSEMBLER__ /* Conversion interfaces. */ # include # include diff --git a/string/test-endian-types.c b/string/test-endian-types.c index a0ff971f24..fa624e39c2 100644 --- a/string/test-endian-types.c +++ b/string/test-endian-types.c @@ -17,7 +17,6 @@ . */ #include -#include int i; uint16_t u16;