Skip to contentSkip to conversation

drivers/base/node.c: fix compilation error

PATCH In review Claudio Scordino 3 participants 5 messages Nov 17, 2011 – Nov 18, 2011 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/base/node.c: fix compilation error

Hi all,

the current mainline kernel gives a "directives may not be used
inside a macro argument" error message when compiled for the cris architecture.

It happened for the /fs/proc/meminfo.c file, for which a patch has been already sent to LKML.

It happens for drivers/base/node.c too. The patch below fixes the problem.

Best regards,

Claudio

Subject: /drivers/base/node.c: fix compilation error
From: Claudio Scordino <[email protected]>

Patch to fix the error message "directives may not be used inside a macro argument" which appears when the kernel is compiled for the cris architecture.

---
 drivers/base/node.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
drivers/base/node.c +8 -6
index 793f796..5693ece 100644
@@ -127,12 +127,13 @@ static ssize_t node_read_meminfo(struct sys_device * dev,
 		       nid, K(node_page_state(nid, NR_WRITEBACK)),
 		       nid, K(node_page_state(nid, NR_FILE_PAGES)),
 		       nid, K(node_page_state(nid, NR_FILE_MAPPED)),
-		       nid, K(node_page_state(nid, NR_ANON_PAGES)
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
+		       nid, K(node_page_state(nid, NR_ANON_PAGES)
 			+ node_page_state(nid, NR_ANON_TRANSPARENT_HUGEPAGES) *
-			HPAGE_PMD_NR
+			HPAGE_PMD_NR),
+#else
+		       nid, K(node_page_state(nid, NR_ANON_PAGES)),
 #endif
-		       ),
 		       nid, K(node_page_state(nid, NR_SHMEM)),
 		       nid, node_page_state(nid, NR_KERNEL_STACK) *
 				THREAD_SIZE / 1024,
@@ -143,13 +144,14 @@ static ssize_t node_read_meminfo(struct sys_device * dev,
 		       nid, K(node_page_state(nid, NR_SLAB_RECLAIMABLE) +
 				node_page_state(nid, NR_SLAB_UNRECLAIMABLE)),
 		       nid, K(node_page_state(nid, NR_SLAB_RECLAIMABLE)),
-		       nid, K(node_page_state(nid, NR_SLAB_UNRECLAIMABLE))
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
+		       nid, K(node_page_state(nid, NR_SLAB_UNRECLAIMABLE))
 			, nid,
 			K(node_page_state(nid, NR_ANON_TRANSPARENT_HUGEPAGES) *
-			HPAGE_PMD_NR)
+			HPAGE_PMD_NR));
+#else
+		       nid, K(node_page_state(nid, NR_SLAB_UNRECLAIMABLE)));
 #endif
-		       );
 	n += hugetlb_report_node_meminfo(nid, buf + n);
 	return n;
 }
Signature · 1 line
1.7.1
#1 lore raw
Quoted 5 lines · Claudio Scordino

Hi all,

the current mainline kernel gives a "directives may not be used
inside a macro argument" error message when compiled for the cris architecture.

Is this because cris is using an older version of gcc, or is it due to something else?

Is this a recent problem, or one that has been around for a long time (i.e. this fix should go to the -stable trees?)

thanks,

greg k-h

#2 lore raw
Quoted 3 lines · Greg KH

Is this a recent problem, or one that has been around for a long time (i.e. this fix should go to the -stable trees?)

The equivalent patch for /proc/meminfo in the -mm tree, fs-proc-meminfoc-fix-compilation-error.patch, was cc'd to stable. This one would have to go back to 2.6.38+.

#3 lore raw
In reply to Greg KH

Il 17/11/2011 18:52, Greg KH ha scritto:

Quoted 9 lines · Claudio Scordino
Quoted 5 lines

Hi all,

the current mainline kernel gives a "directives may not be used
inside a macro argument" error message when compiled for the cris architecture.

Is this because cris is using an older version of gcc, or is it due to something else?

Hi Greg.

The compiler I used it's still the same I used in the past (i.e., gcc 3.2.1):

/usr/local/cris/bin/cris-axis-linux-gnu-gcc -v
Reading specs from /usr/local/cris/lib/gcc-lib/cris-axis-linux-gnu/3.2.1/specs
Configured with: /home/cii/cris-dist/./gnu-toplev/configure --enable-version-specific-runtime-libs --disable-nls --target=cris-axis-linux-gnu --without-newlib --with-headers=installed --enable-languages=c,c++ --enable-shared --enable-threads=posix --prefix=/usr/local/cris Thread model: posix
gcc version 3.2.1 Axis release R64/1.64

It's contained inside the cris-dist_1.64-1_i386.deb package. I don't know if a newer compiler has been made available by the Axis group.

However, I never found this issue when compiling /fs/proc/meminfo.c in the past. Therefore, I couldn't find the same error in drivers/base/node.c either.

I suspect that /fs/proc/meminfo.c has been recently changed, and then the same (old) compiler started complaining.

The two patches I have sent are very trivial, but allow to fix those build problems.

Best regards,

Claudio