New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 916736 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug
Build-Toolchain



Sign in to add a comment

Adding '-save-temps' make clang warn about more stuff

Project Member Reported by diand...@chromium.org, Dec 19

Issue description

If I add this patch to my Chrome OS kernel 4.19 Makefile:

---

diff --git a/Makefile b/Makefile
index a44e05a23631..fc3f463f2bee 100644
--- a/Makefile
+++ b/Makefile
@@ -421,7 +421,7 @@ KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
                   -fno-strict-aliasing -fno-common -fshort-wchar \
                   -Werror-implicit-function-declaration \
                   -Wno-format-security \
-                  -std=gnu89
+                  -std=gnu89 -save-temps
 KBUILD_CPPFLAGS := -D__KERNEL__
 KBUILD_AFLAGS_KERNEL :=
 KBUILD_CFLAGS_KERNEL :=

---

You start getting errors when you build like:

In file included from /mnt/host/source/src/third_party/kernel/v4.19/kernel/sysctl.c:53:
In file included from /mnt/host/source/src/third_party/kernel/v4.19/include/linux/nfs_fs.h:32:
In file included from /mnt/host/source/src/third_party/kernel/v4.19/include/linux/sunrpc/clnt.h:28:
/mnt/host/source/src/third_party/kernel/v4.19/include/net/ipv6.h:334:8: error: explicitly assigning value of variable of type 'struct ipv6_txoptions *' to itself [-Werror,-Wself-assign]
   opt = (opt);
   ~~~ ^  ~~~

-

/mnt/host/source/src/third_party/kernel/v4.19/mm/memory.c:4602:61: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
 if ((((((struct thread_info *)get_current())->addr_limit)) == ((((-1UL))))))
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/mnt/host/source/src/third_party/kernel/v4.19/mm/memory.c:4602:61: note: remove extraneous parentheses around the comparison to silence this warning
 if ((((((struct thread_info *)get_current())->addr_limit)) == ((((-1UL))))))
     ~                                                      ^              ~
/mnt/host/source/src/third_party/kernel/v4.19/mm/memory.c:4602:61: note: use '=' to turn this equality comparison into an assignment
 if ((((((struct thread_info *)get_current())->addr_limit)) == ((((-1UL))))))

-

/mnt/host/source/src/third_party/kernel/v4.19/mm/mlock.c:389:6: error: explicitly assigning value of variable of type 'unsigned long' to itself [-Werror,-Wself-assign]
 end = (end);
 ~~~ ^  ~~~

-

In file included from /mnt/host/source/src/third_party/kernel/v4.19/kernel/cgroup/cgroup.c:61:
In file included from /mnt/host/source/src/third_party/kernel/v4.19/include/trace/events/cgroup.h:155:
In file included from /mnt/host/source/src/third_party/kernel/v4.19/include/trace/define_trace.h:97:
In file included from /mnt/host/source/src/third_party/kernel/v4.19/include/trace/perf.h:90:
/mnt/host/source/src/third_party/kernel/v4.19/include/trace/events/cgroup.h:11:1547: error: address of array 'root->name' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
  ...__data_offsets.name; { entry->root = root->hierarchy_id; entry->ss_mask = root->subsys_mask; strcpy(((char *)((void *)entry + (entry->__data_loc_name & 0xffff))), (root->name) ? (const char *)(r...

---

Presumably adding '-save-temps' is somehow re-enabling a bunch of warnings that we wanted to silence?

Forked from bug #914583
 
Owner: llozano@chromium.org
Status: Assigned (was: Untriaged)
ok, I think this is explained here: 

http://petereisentraut.blogspot.com/2011/09/ccache-and-clang-part-2.html

so, what I believe is happening is that -save-temps forces the generation of the preprocessed file and then feeds back into clang. All the knowledge of macro expansions gets lost and these warnings are generated.


Sign in to add a comment