From owner-svn-src-all@freebsd.org Sat Jun 8 19:16:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CF0815B0FC9; Sat, 8 Jun 2019 19:16:45 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay105.isp.belgacom.be (mailrelay105.isp.belgacom.be [195.238.20.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "relay.skynet.be", Issuer "GlobalSign Organization Validation CA - SHA256 - G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3C6BF6F3AD; Sat, 8 Jun 2019 19:16:44 +0000 (UTC) (envelope-from tijl@freebsd.org) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2DdAAAFCPxc/1H1sVtlGwEBAQEDAQE?= =?us-ascii?q?BBwMBAQGBUwQBAQELAQGCD0cSEVEBIBIUFI0QiXYBAYIMNQGKCI4igXsJAQE?= =?us-ascii?q?CAQEBAQErDAEBhEACgmkkNgcOAQMBAQUBAQEBBG0cDEIWAYRyAQU6HCMQCw4?= =?us-ascii?q?GBAklD0gGE4Mjgg4LqA6EMgELAYRcgQoGgTQBi3OBf4EQAYMSPoREhWIElAi?= =?us-ascii?q?URVoJghGGRIxyJ5cbhAqQHJElBSyBWE0wCIMnghsXiGGFQT0DMIsMhREBAQ?= X-IPAS-Result: =?us-ascii?q?A2DdAAAFCPxc/1H1sVtlGwEBAQEDAQEBBwMBAQGBUwQBA?= =?us-ascii?q?QELAQGCD0cSEVEBIBIUFI0QiXYBAYIMNQGKCI4igXsJAQECAQEBAQErDAEBh?= =?us-ascii?q?EACgmkkNgcOAQMBAQUBAQEBBG0cDEIWAYRyAQU6HCMQCw4GBAklD0gGE4Mjg?= =?us-ascii?q?g4LqA6EMgELAYRcgQoGgTQBi3OBf4EQAYMSPoREhWIElAiURVoJghGGRIxyJ?= =?us-ascii?q?5cbhAqQHJElBSyBWE0wCIMnghsXiGGFQT0DMIsMhREBAQ?= Received: from 81.245-177-91.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([91.177.245.81]) by relay.skynet.be with ESMTP; 08 Jun 2019 21:15:33 +0200 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.15.2/8.15.2) with ESMTP id x58JFWVM039169; Sat, 8 Jun 2019 21:15:32 +0200 (CEST) (envelope-from tijl@FreeBSD.org) Date: Sat, 8 Jun 2019 21:15:32 +0200 From: =?UTF-8?B?VMSzbA==?= Coosemans To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r348798 - head/sys/amd64/amd64 Message-ID: <20190608211532.37dd2f38@kalimero.tijl.coosemans.org> In-Reply-To: <201906081340.x58DevdV013600@repo.freebsd.org> References: <201906081340.x58DevdV013600@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 3C6BF6F3AD X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.96 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2019 19:16:45 -0000 On Sat, 8 Jun 2019 13:40:57 +0000 (UTC) Konstantin Belousov wrote: > Author: kib > Date: Sat Jun 8 13:40:57 2019 > New Revision: 348798 > URL: https://svnweb.freebsd.org/changeset/base/348798 > > Log: > amd64 trap.c: Modernize syntax around trap_msg[]. > > Convert the array to use C99 initializers. > Make it constant. > Replace MAX_TRAP_MSG with nitems(). > > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > > Modified: > head/sys/amd64/amd64/trap.c > > Modified: head/sys/amd64/amd64/trap.c > ============================================================================== > --- head/sys/amd64/amd64/trap.c Sat Jun 8 09:34:02 2019 (r348797) > +++ head/sys/amd64/amd64/trap.c Sat Jun 8 13:40:57 2019 (r348798) > @@ -118,41 +118,41 @@ static bool trap_user_dtrace(struct trapframe *, > int (**hook)(struct trapframe *)); > #endif > > -#define MAX_TRAP_MSG 32 > -static char *trap_msg[] = { > - "", /* 0 unused */ > - "privileged instruction fault", /* 1 T_PRIVINFLT */ > - "", /* 2 unused */ > - "breakpoint instruction fault", /* 3 T_BPTFLT */ > - "", /* 4 unused */ > - "", /* 5 unused */ > - "arithmetic trap", /* 6 T_ARITHTRAP */ > - "", /* 7 unused */ > - "", /* 8 unused */ > - "general protection fault", /* 9 T_PROTFLT */ > - "debug exception", /* 10 T_TRCTRAP */ > - "", /* 11 unused */ > - "page fault", /* 12 T_PAGEFLT */ > - "", /* 13 unused */ > - "alignment fault", /* 14 T_ALIGNFLT */ > - "", /* 15 unused */ > - "", /* 16 unused */ > - "", /* 17 unused */ > - "integer divide fault", /* 18 T_DIVIDE */ > - "non-maskable interrupt trap", /* 19 T_NMI */ > - "overflow trap", /* 20 T_OFLOW */ > - "FPU bounds check fault", /* 21 T_BOUND */ > - "FPU device not available", /* 22 T_DNA */ > - "double fault", /* 23 T_DOUBLEFLT */ > - "FPU operand fetch fault", /* 24 T_FPOPFLT */ > - "invalid TSS fault", /* 25 T_TSSFLT */ > - "segment not present fault", /* 26 T_SEGNPFLT */ > - "stack fault", /* 27 T_STKFLT */ > - "machine check trap", /* 28 T_MCHK */ > - "SIMD floating-point exception", /* 29 T_XMMFLT */ > - "reserved (unknown) fault", /* 30 T_RESERVED */ > - "", /* 31 unused (reserved) */ > - "DTrace pid return trap", /* 32 T_DTRACE_RET */ > +static const char UNKNOWN[] = "unknown"; > +static const char *trap_msg[] = { Maybe the array itself can also be const: static const char *const trap_msg[]