From nobody Mon May 22 20:16:27 2023 X-Original-To: freebsd-arch@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QQ7yP2GqYz4CPjB for ; Mon, 22 May 2023 20:16:45 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic312-24.consmr.mail.gq1.yahoo.com (sonic312-24.consmr.mail.gq1.yahoo.com [98.137.69.205]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4QQ7yP00Gwz47tr for ; Mon, 22 May 2023 20:16:44 +0000 (UTC) (envelope-from marklmi@yahoo.com) Authentication-Results: mx1.freebsd.org; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1684786603; bh=uc5X7lKSy0/f1E8ZLVVdLRUgx7wmDTxZBTrq63f4RaI=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From:Subject:Reply-To; b=KnI2j6heegNBIvnov4eKA3ThnXQ/wWlrTBhJH7t1OKzbiNLKdzpn7udk33rKhpYmSV5XWrM1s1uD+bkPglR+Ui6G57WxaWU0B+A6BCJ2WfmqVAH9zqwGo23NxEBqlNkl0q+tm33a/FOYi3rr1i+OtgGMz1JjEowkbn8xmBlofCA7ELxfNdxKLOxiqDoGZR7PyMxbHqJCBqb7+PbxwIr9pD7dDyIZVlt/4cV0rEyRaZqh2opoBOfgDTzk9JCp/ThfiLTHMA0wjmLXrAfXALzBc0mk7WUyH1ekEShb6P6Bwuf8uRa22hVbIjIh6c/LyWQo40QU14JwUG5AuZFJasOK0w== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1684786603; bh=lC9DkOqnjmXwAVC9CG3hiohFQNLi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OLYz83MrdIkPH30VQ2IGXw2pQfM6xleBxvSZ81V6pquFBRmJwJCdcTQAvK0a2Xoeiksoet eoKRyjXB8hyvRsnM5n.onuJg20sEBLEsx9VaxXQ8_3EBNuSIv6PpwmyYHR334YSCbbqnxajhbFb1 iveKW_KimsmPRMarBOFJdRdOXIIBACHdJExIg9GR8h1eZDH0Dp94cVJl._ta69LvIg8KT_sy3tdL qiFWaxta3mpqR5kKMRe.ann4ybgfwl0SpAmBQGia1354LTWHZMTOMJd1uqw2gYgeZRx3SYQwG0mZ pPlKVi8KeZixKQFwWXfASwwexYWl9i0l1RC9cJhIczJUevlGAUltRoh4.oPSW_7woxmaJnH8ekLN Eakvw9.Cjvwmh8WDlGSl.s.ThtDVK3IU15BB42.Q2avx3xgnxVe7JDz5kvZorq9XIjJdkkiXwMqW 23b55Qk3FXjsrgiP.XsZZebV5dzb1N3tRm6f4v.mWjvlWxL8cuMv8A8AJKN2lKXeNikxFga.L2Bv ydMI_W0xRZsKVq5zQwj04lBSpi6ixPA3Ao4mY6XCtZSwBPY_ESn_f6CZiQb5JedQnlAg4ZEhz5h1 gmRg- X-Sonic-MF: X-Sonic-ID: b7a53b77-2dee-44eb-9d29-7ed47a5009b8 Received: from sonic.gate.mail.ne1.yahoo.com by sonic312.consmr.mail.gq1.yahoo.com with HTTP; Mon, 22 May 2023 20:16:43 +0000 Received: by hermes--production-ne1-574d4b7954-cm564 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID aa5673f7dfb74d7d5743395adf81e0f3; Mon, 22 May 2023 20:16:39 +0000 (UTC) Content-Type: text/plain; charset=us-ascii List-Id: Discussion related to FreeBSD architecture List-Archive: https://lists.freebsd.org/archives/freebsd-arch List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arch@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) Subject: Re: [RFC] An idea for general kernel post-processing automation in FreeBSD From: Mark Millard In-Reply-To: Date: Mon, 22 May 2023 13:16:27 -0700 Cc: freebsd-arch Content-Transfer-Encoding: quoted-printable Message-Id: References: <2EDDC5DC-81C2-4EB8-B729-66F03A8854E4.ref@yahoo.com> <2EDDC5DC-81C2-4EB8-B729-66F03A8854E4@yahoo.com> <6293f06b-927f-432a-3911-808b1d99441b@selasky.org> To: Hans Petter Selasky X-Mailer: Apple Mail (2.3731.400.51.1.1) X-Rspamd-Queue-Id: 4QQ7yP00Gwz47tr X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/20, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On May 22, 2023, at 03:00, Hans Petter Selasky wrote: > On 5/22/23 01:07, Mark Millard wrote: >> In the C language standard, the original had a status of "no linkage" >> and "static storage duration". ("a block scope identifier >> for an object declared without the storage-class specifier >> extern" leads to the "no linkage" status.) >> The change still has "static storage duration" but now has "internal >> linkage" status instead. I'm being cautious about the distinction. >> (I'm looking at ISO/IEC 9899:2011 (E).) >> I've had trouble identifying the match of your wordings to the >> language standard, leaving me unsure of the interpretation to >> give your wording. >> I've yet to figure out why internal linkage could end up >> being required, given how the language specifies things. >=20 > Hi, >=20 > If you find something, let me know. I'll let the issue rest for some = days. Okay. File the below for later. (Some detailed whitespace below might not survive.) I still find no reason in the C11 standard to change the code in question from: Block Scope, No Linkage, Static Storage Duration into: File Scope, Internal Linkage, Static Storage Duration I'll ponder the standard's text some more but I doubt that I'll find something that I've missed so far. I propose using 2 source files that I show below as the basis for terminology. I set them up based on text from the C11 standard. If you can explain why Internal Linkage would be required in terms of some similar example and terminology, it would help be sure I'm not missing something that you are referencing. (Part of the text was just me trying to make sure that I'd appropriately covered the allowed combinations of official language concepts that are involved.) # more NameScope_Linkage_StorageDuration_combinations.c // For -std=3Dc99 or c11 or c17 or c2x (showing c99): // cc -std=3Dc99 -pedantic -Wall -Wextra -c = FileScope_ExternalLinkage_initialization.c // cc -std=3Dc99 -pedantic -Wall -Wextra = NameScope_Linkage_StorageDuration_combinations.c = FileScope_ExternalLinkage_initialization.o // ./a.out // gcc13 -std=3Dc99 -pedantic -Wall -Wextra -c = FileScope_ExternalLinkage_initialization.c // gcc13 -std=3Dc99 -pedantic -Wall -Wextra = NameScope_Linkage_StorageDuration_combinations.c = FileScope_ExternalLinkage_initialization.o // ./a.out // Indentification of contexts and the subset covered here: // Just objects (not macros, functions, tags, typedefs names, lables, = etc.): // (Note: function prototype scope is not relevant here) // // Scopes (visibility): Block, File // Linkages: None (No), External, Internal // Storage durations: Automatic, Static (, Thread, Allocated) // Name space: Ordinary Identifiers (Note: no alternatives) // Note: I do not cover any thread-storage-duration related contexts = here. // Note: I do not cover any allocated-storage-duration contexts here. // Note: I do not cover the special non-lvalue expression contexts here // that involve the combination: // temporary-lifetime and automatic-storage-duration // For reference: // Static Storage Duration: "Its lifetime is the entire execution of the // program and its storage value is = initialized // only once, prior to program startup." // // It need not be tied to file scope or to external/internal linkage. // Covered here: // Block Scope, No Linkage, Automatic Storage Duration // Block Scope, No Linkage, Static Storage Duration // Block Scope, External Linkage, Static Storage Duration // File Scope, Internal Linkage, Static Storage Duration // File Scope, External Linkage, Static Storage Duration // Note: Only external linkage objects have a definition vs. // declaration distinction. // I count 4 distinct non-stack types of whole-program-lifetime // object contexts in that list: The static-storage-duration ones. // But: // // Block Scope, External Linkage, Static Storage Duration // // can only be used to declare access to an external-linkage // defined elsewhere (defined outside any block scope). // Note: There is no such thing as the combination: // Block Scope, Internal Linkage, Static Storage Duration // Note: "Each declaration of an identifier with no linkage // denotes a unique entity." This prevents various // forms of multiple declarations for the same // namespace and scope combination. #include // Note: Only automatic storage duration is in a call stack. int Using_BlockScope_NoLinkage_AutomaticStorageDuration(void) { int BlockScope_NoLinkage_AutomaticStorageDuration =3D 1; return ++BlockScope_NoLinkage_AutomaticStorageDuration; } // Note: No direct notation for file scope access exists but // the storage duration spans when the function is not // in use. int Using_BlockScope_NoLinkage_StaticStorageDuration(void) { static int BlockScope_NoLinkage_StaticStorageDuration =3D 1; return ++BlockScope_NoLinkage_StaticStorageDuration; } int Using_BlockScope_ExternalLinkage_StaticStorageDuration(void) { // Note: Defined/initialized in = FileScope_ExternalLinkage_initialization.c // Such an external definition is not allowed in block scope. extern int ExternalLinkage_StaticStorageDuration; // a declaration return ++ExternalLinkage_StaticStorageDuration; } // Note: To have internal linkage requires a file scope declaration. static int FileScope_InternalLinkage_StaticStorageDuration =3D 1; // Note: after such an internal linkage definition, the following // is allowed (not required) but does not change the status. // "extern" does not always mean external-storage-duration. extern int FileScope_InternalLinkage_StaticStorageDuration; int Using_FileScope_InternalLinkage_StaticStorageDuration(void) { // Note: after such an internal linkage definition, the following // is allowed (not required) but does not change the status. // "extern" does not always mean external-storage-duration. extern int FileScope_InternalLinkage_StaticStorageDuration; return ++FileScope_InternalLinkage_StaticStorageDuration; } // Note: Defined/initialized in = FileScope_ExternalLinkage_initialization.c extern int FileScope_ExternalLinkage_StaticStorageDuration; // a = declaration // Note: Without "extern", a definition would be allowed above, instead // of having one in FileScope_ExternalLinkage_initialization.c . int Using_FileScope_ExternalLinkage_StaticStorageDuration(void) { return ++FileScope_ExternalLinkage_StaticStorageDuration; } int main(void) { (void) Using_BlockScope_NoLinkage_AutomaticStorageDuration(); printf("Using_BlockScope_NoLinkage_AutomaticStorageDuration() : %d = (expect 2)\n" , Using_BlockScope_NoLinkage_AutomaticStorageDuration()); (void) Using_BlockScope_NoLinkage_StaticStorageDuration(); printf("Using_BlockScope_NoLinkage_StaticStorageDuration() : %d = (expect 3)\n" , Using_BlockScope_NoLinkage_StaticStorageDuration()); (void) Using_BlockScope_ExternalLinkage_StaticStorageDuration(); printf("Using_BlockScope_ExternalLinkage_StaticStorageDuration(): %d = (expect 3)\n" , Using_BlockScope_ExternalLinkage_StaticStorageDuration()); (void) Using_FileScope_InternalLinkage_StaticStorageDuration(); printf("Using_FileScope_InternalLinkage_StaticStorageDuration() : %d = (expect 3)\n" , Using_FileScope_InternalLinkage_StaticStorageDuration()); printf("Accessing FileScope_InternalLinkage_StaticStorageDuration : = %d (expect 3 again)\n" , FileScope_InternalLinkage_StaticStorageDuration); } # more FileScope_ExternalLinkage_initialization.c // For -std=3Dc99 or c11 or c17 or c2x (showing c99): // cc -std=3Dc99 -pedantic -Wall -Wextra -c = NameScope_Linkage_StorageDuration_combinations.c // gcc13 -std=3Dc99 -pedantic -Wall -Wextra -c = NameScope_Linkage_StorageDuration_combinations.c // Defined at file scope here. // Used separately at block scope elsewhere. // The definition can not be in block scope. int ExternalLinkage_StaticStorageDuration =3D 1; // a definition // Defined at file scope here. // Used separately at file scope elsewhere. int FileScope_ExternalLinkage_StaticStorageDuration =3D 1; // a = definition =3D=3D=3D Mark Millard marklmi at yahoo.com