All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Cong Ding <dinggnu@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	"yrl.pp-manager.tt@hitachi.com" <yrl.pp-manager.tt@hitachi.com>
Subject: Re: [PATCH v2] arch/x86/tools/gen-insn-attr-x86.awk: remove duplicate const
Date: Mon, 10 Dec 2012 10:27:51 +0900	[thread overview]
Message-ID: <50C53A97.4010409@hitachi.com> (raw)
In-Reply-To: <6335450a-8ba4-4e88-a996-49225f0ec890@email.android.com>

(2012/12/10 10:03), H. Peter Anvin wrote:
> Yes, if you add a * it becomes an array of pointers.

Right, I would like to make each pointer in the array read-only.

And, of course, the data itself which pointed by the pointer
is already protected.
You can see this in (builddir)/arch/x86/lib/inat_table.c
----
/* Table: 2-byte opcode (0x0f) */
const insn_attr_t inat_escape_table_1[INAT_OPCODE_TABLE_SIZE] = {
[...]
/* Escape opcode map array */
const insn_attr_t * const inat_escape_tables[INAT_ESC_MAX + 1][INAT_LSTPFX_MAX +
 1] = {
        [1][0] = inat_escape_table_1,
----

So I think Cong's v3 is good :)

Thank you,

> 
> Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> wrote:
> 
>> (2012/12/10 0:50), H. Peter Anvin wrote:
>>> No, that would really be wrong - changing the type.
>>
>> What would be wrong? IMHO, this is just a fix to add a fool
>> proof 'const' to array instance itself.
>> ...Or, am I missed anything?
>>
>> Thank you,
>>
>>> Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> wrote:
>>>
>>>> (2012/12/08 8:17), Cong Ding wrote:
>>>>>>>>>> Patch description please?
>>>>>>>>> there are 2 consts in the definition of one variable
>>>>>>>>>
>>>>>>>>
>>>>>>>> Please put in an actual patch description.  The first line
>>>> (subject
>>>>>>>> line) is a title; the patch should make sense without it.
>>>>>>> sorry for that. so like this is fine?
>>>>>>>
>>>>>>
>>>>>> Well, except that typically you should explain which variable it
>> is.
>>>>>> Yes, it is obvious if you look at the patch, but you're making the
>>>>>> reader spend a few more moments than necessary.
>>>>>>
>>>>>> Also, you should explain what the harm is -- if it breaks anything
>>>>>> or is just a cosmetic issue.
>>>>> sorry again for lacking of experience...
>>>>> and I missed another same error, so send version 2.
>>>>
>>>> Ah, sorry for my mistake. I would like to make both the value
>>>> pointed by the pointers and the pointers itself read-only.
>>>> Thus the right way of the patch should be;
>>>>
>>>> -	print "const insn_attr_t const *inat_escape_tables[INAT_ESC_MAX +
>> 1]"
>>>> \
>>>> +	print "const insn_attr_t * const inat_escape_tables[INAT_ESC_MAX +
>>>> 1]" \
>>>>
>>>> Cong, could you update your patch? then I can Ack that.
>>>>
>>>> Thank you,
>>>>
>>>>>
>>>>> - cong
>>>>> ---
>>>>> From 6cf729b913287a6fc06325ca75ccf0efff9274e8 Mon Sep 17 00:00:00
>>>> 2001
>>>>> From: Cong Ding <dinggnu@gmail.com>
>>>>> Date: Fri, 7 Dec 2012 23:14:32 +0000
>>>>> Subject: [PATCH] arch/x86/tools/gen-insn-attr-x86.awk: remove
>>>> duplicate const
>>>>>
>>>>> fix the following sparse warning:
>>>>> arch/x86/lib/inat-tables.c:1080:25: warning: duplicate const
>>>>> arch/x86/lib/inat-tables.c:1095:25: warning: duplicate const
>>>>> arch/x86/lib/inat-tables.c:1118:25: warning: duplicate const
>>>>>
>>>>> for variable inat_escape_tables, inat_group_tables, and
>>>> inat_avx_tables
>>>>>
>>>>> Signed-off-by: Cong Ding <dinggnu@gmail.com>
>>>>> ---
>>>>>  arch/x86/tools/gen-insn-attr-x86.awk |    6 +++---
>>>>>  1 files changed, 3 insertions(+), 3 deletions(-)
>>>>>
>>>>> diff --git a/arch/x86/tools/gen-insn-attr-x86.awk
>>>> b/arch/x86/tools/gen-insn-attr-x86.awk
>>>>> index ddcf39b..987c7b2 100644
>>>>> --- a/arch/x86/tools/gen-insn-attr-x86.awk
>>>>> +++ b/arch/x86/tools/gen-insn-attr-x86.awk
>>>>> @@ -356,7 +356,7 @@ END {
>>>>>  		exit 1
>>>>>  	# print escape opcode map's array
>>>>>  	print "/* Escape opcode map array */"
>>>>> -	print "const insn_attr_t const *inat_escape_tables[INAT_ESC_MAX +
>>>> 1]" \
>>>>> +	print "const insn_attr_t *inat_escape_tables[INAT_ESC_MAX + 1]" \
>>>>>  	      "[INAT_LSTPFX_MAX + 1] = {"
>>>>>  	for (i = 0; i < geid; i++)
>>>>>  		for (j = 0; j < max_lprefix; j++)
>>>>> @@ -365,7 +365,7 @@ END {
>>>>>  	print "};\n"
>>>>>  	# print group opcode map's array
>>>>>  	print "/* Group opcode map array */"
>>>>> -	print "const insn_attr_t const *inat_group_tables[INAT_GRP_MAX +
>>>> 1]"\
>>>>> +	print "const insn_attr_t *inat_group_tables[INAT_GRP_MAX + 1]"\
>>>>>  	      "[INAT_LSTPFX_MAX + 1] = {"
>>>>>  	for (i = 0; i < ggid; i++)
>>>>>  		for (j = 0; j < max_lprefix; j++)
>>>>> @@ -374,7 +374,7 @@ END {
>>>>>  	print "};\n"
>>>>>  	# print AVX opcode map's array
>>>>>  	print "/* AVX opcode map array */"
>>>>> -	print "const insn_attr_t const *inat_avx_tables[X86_VEX_M_MAX +
>>>> 1]"\
>>>>> +	print "const insn_attr_t *inat_avx_tables[X86_VEX_M_MAX + 1]"\
>>>>>  	      "[INAT_LSTPFX_MAX + 1] = {"
>>>>>  	for (i = 0; i < gaid; i++)
>>>>>  		for (j = 0; j < max_lprefix; j++)
>>>>>
>>>
> 


-- 
Masami HIRAMATSU
IT Management Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com



  reply	other threads:[~2012-12-10  1:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-07 22:42 [PATCH] arch/x86/tools/gen-insn-attr-x86.awk: remove duplicate const Cong Ding
2012-12-07 22:45 ` H. Peter Anvin
2012-12-07 22:49   ` Cong Ding
2012-12-07 22:56     ` H. Peter Anvin
2012-12-07 23:03       ` Cong Ding
2012-12-07 23:06         ` H. Peter Anvin
2012-12-07 23:17           ` [PATCH v2] " Cong Ding
2012-12-07 23:28             ` H. Peter Anvin
2012-12-08  0:04             ` [tip:x86/cleanups] x86: Remove duplicate "const" in gen-insn-attr-x86.awk tip-bot for Cong Ding
2012-12-09  5:24             ` [PATCH v2] arch/x86/tools/gen-insn-attr-x86.awk: remove duplicate const Masami Hiramatsu
2012-12-09  8:21               ` [PATCH v3] x86: fix the error of using "const" in gen-insn-attr-x86.awk Cong Ding
2012-12-10 21:17                 ` [tip:x86/cleanups] x86: Fix " tip-bot for Cong Ding
2012-12-09  8:27               ` [PATCH v2] arch/x86/tools/gen-insn-attr-x86.awk: remove duplicate const Cong Ding
2012-12-09 15:50               ` H. Peter Anvin
2012-12-10  1:00                 ` Masami Hiramatsu
2012-12-10  1:03                   ` H. Peter Anvin
2012-12-10  1:27                     ` Masami Hiramatsu [this message]
2012-12-10  1:34                       ` H. Peter Anvin
2012-12-10  1:50                         ` Masami Hiramatsu
2012-12-10  1:56                           ` H. Peter Anvin

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=50C53A97.4010409@hitachi.com \
    --to=masami.hiramatsu.pt@hitachi.com \
    --cc=dinggnu@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yrl.pp-manager.tt@hitachi.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.