AW: Wonly-top-basic-asm

Bernd Edlinger bernd.edlinger@hotmail.de
Mon Feb 8 06:45:00 GMT 2016


On 8. 2. 2016 04:45, David Wohlferd wrote:
> Hey Bernd.
> 
> I replied with a patch that includes most of the changes you asked for
> (see inline below).  Were you waiting on me for something more?
> 

ChangeLog entries are still missing.

> I have cleaned up the testcases so they aren't so i386-specific, but
> otherwise this patch (attached) is the same.  Let me know if there is
> something more I need to do here.
> 
> Thanks,
> dw

David, there is a tool that you can use to check the patch
for some style-nits before submission.

I used it and it complains about these things:
contrib/check_GNU_style.sh 24414Q.patch

Blocks of 8 spaces should be replaced with tabs.
29:+                            DECL_ATTRIBUTES (current_function_decl)) 
30:+          == NULL_TREE)
31:+        warning_at (asm_loc, OPT_Wonly_top_basic_asm, 
32:+                    "asm statement in function does not use extended syntax");
57:+	         EXCEPT when in naked functions.  Also allow asm(""). */
59:+	          && TREE_STRING_LENGTH (string) != 1)
60:+	        if (lookup_attribute("naked",
61:+	                             DECL_ATTRIBUTES (current_function_decl))
62:+	            == NULL_TREE)
63:+	          warning_at (asm_loc, OPT_Wonly_top_basic_asm,
64:+	                      "asm statement in function does not use extended"
65:+                              " syntax");

Trailing whitespace.
25:+    /* Warn on basic asm used inside of functions, 
28:+      if (lookup_attribute ("naked", 
29:+                            DECL_ATTRIBUTES (current_function_decl)) 
31:+        warning_at (asm_loc, OPT_Wonly_top_basic_asm, 

Dot, space, space, end of comment.
122:+/* Define macro at file scope with basic asm. */
123:+/* Add macro parameter p to eax. */
130:+/* the "a" constraint since it modifies eax. */
186:+  /* basic asm should not warn in naked functions. */

Sentences should end with a dot.  Dot, space, space, end of the comment.
128:+/* Use macro in function using extended asm.  It needs */
129:+/* the "cc" clobber since the flags are changed and uses */
187:+   asm(" "); /* no warning */
203:+/* acceptable */
209:+/* acceptable */
212:+/* acceptable */
215:+/* acceptable */
221:+   /* acceptable */
227:+   /* acceptable */
230:+   /* acceptable */
233:+   /* acceptable */
236:+   /* warning */

There should be exactly one space between function name and parentheses.
10:+C ObjC ObjC++ C++ Var(warn_only_top_basic_asm) Warning
26:+       EXCEPT when in naked functions.  Also allow asm(""). */
57:+	         EXCEPT when in naked functions.  Also allow asm(""). */
60:+	        if (lookup_attribute("naked",
124:+asm(".macro test p\n\t"
131:+int DoAdd(int value)
133:+   asm("test 5" : "+a" (value) : : "cc");
187:+   asm(" "); /* no warning */
190:+int main(int argc, char *argv[])
192:+   return func(argc, argc);
202:+#if defined(__i386__) || defined(__x86_64__)
204:+register int b asm("esi");
218:+int main(int argc, char *argv[])
220:+#if defined(__i386__) || defined(__x86_64__)
222:+   register int a asm("edi");
228:+   asm(" "::"r"(a), "r" (b));
234:+   asm("");
237:+   asm(" "); /* { dg-warning "does not use extended syntax" } */

Well regarding line 10 that is of course correct syntax.
And I looked with vi at gcc/testsuite/c-c++-common/Wonly-top-basic-asm.c
it seems to be using mixed windows and unix style line endings.
I would use unix line endings wherever possible, for consistency.


Thanks
Bernd.


More information about the Gcc-patches mailing list