Skip to contentSkip to conversation

tools/mm: fix show_page() build error

PATCH In review Oleksandr Natalenko 2 participants 3 messages Nov 14, 2024 Memory management

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/mm: fix show_page() build error

At one point I needed mm tools for debugging but couldn't compile them due to the following error:

gcc -Wall -Wextra -I../lib/ -pthread -o page-types page-types.c ../lib/api/libapi.a -pthread page-types.c: In function ‘show_page’:
page-types.c:423:49: error: expected ‘;’ before ‘if’

  423 |                 printf("@%" PRIu64 "\t", cgroup)
      |                                                 ^
      |                                                 ;
  424 |         if (opt_list_mapcnt)
      |         ~~

page-types.c:416:65: warning: unused parameter ‘mapcnt’ [-Wunused-parameter]
416 | uint64_t flags, uint64_t cgroup, uint64_t mapcnt)
| ~~~~~~~~~^~~~~~
make: *** [Makefile:23: page-types] Error 1

Trailing ; was forgotten, so add it.

Fixes ece5897e5a10 ("tools/mm: -Werror fixes in page-types/slabinfo")
---
 tools/mm/page-types.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/mm/page-types.c +1 -1
index 6eb17cc1a06c5..bcac7ebfb51fd 100644
@@ -420,7 +420,7 @@ static void show_page(unsigned long voffset, unsigned long offset,
 	if (opt_file)
 		printf("%lx\t", voffset);
 	if (opt_list_cgroup)
-		printf("@%" PRIu64 "\t", cgroup)
+		printf("@%" PRIu64 "\t", cgroup);
 	if (opt_list_mapcnt)
 		printf("%" PRIu64 "\t", mapcnt);
 
Signature · 1 line
2.47.0
#1 lore raw

Hi Oleksandr,

Quoted 39 lines · On Thu, 14 Nov 2024 11:01:40 +0100 Oleksandr Natalenko…

At one point I needed mm tools for debugging but couldn't compile them due to the following error:

gcc -Wall -Wextra -I../lib/ -pthread -o page-types page-types.c ../lib/api/libapi.a -pthread page-types.c: In function \u2018show_page\u2019:
page-types.c:423:49: error: expected \u2018;\u2019 before \u2018if\u2019

  423 |                 printf("@%" PRIu64 "\t", cgroup)
      |                                                 ^
      |                                                 ;
  424 |         if (opt_list_mapcnt)
      |         ~~

page-types.c:416:65: warning: unused parameter \u2018mapcnt\u2019 [-Wunused-parameter]
416 | uint64_t flags, uint64_t cgroup, uint64_t mapcnt)
| ~~~~~~~~~^~~~~~
make: *** [Makefile:23: page-types] Error 1

Trailing ; was forgotten, so add it.

Fixes ece5897e5a10 ("tools/mm: -Werror fixes in page-types/slabinfo")
---
 tools/mm/page-types.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/mm/page-types.c +1 -1
index 6eb17cc1a06c5..bcac7ebfb51fd 100644
@@ -420,7 +420,7 @@ static void show_page(unsigned long voffset, unsigned long offset,
 	if (opt_file)
 		printf("%lx\t", voffset);
 	if (opt_list_cgroup)
-		printf("@%" PRIu64 "\t", cgroup)
+		printf("@%" PRIu64 "\t", cgroup);
 	if (opt_list_mapcnt)
 		printf("%" PRIu64 "\t", mapcnt);
 
Signature · 1 line
2.47.0

Just FYI, a very similar patch has posted a few days ago:
https://lore.kernel.org/[email protected]

Thanks,
SJ

#2 lore raw

Hello.

Quoted 26 lines · středoevropský standardní čas SeongJae Park
Quoted 24 lines · On Thu, 14 Nov 2024 11:01:40 +0100 Oleksandr Natalenko…

At one point I needed mm tools for debugging but couldn't compile them due to the following error:

gcc -Wall -Wextra -I../lib/ -pthread -o page-types page-types.c ../lib/api/libapi.a -pthread page-types.c: In function \u2018show_page\u2019:
page-types.c:423:49: error: expected \u2018;\u2019 before \u2018if\u2019

  423 |                 printf("@%" PRIu64 "\t", cgroup)
      |                                                 ^
      |                                                 ;
  424 |         if (opt_list_mapcnt)
      |         ~~

page-types.c:416:65: warning: unused parameter \u2018mapcnt\u2019 [-Wunused-parameter]
416 | uint64_t flags, uint64_t cgroup, uint64_t mapcnt)
| ~~~~~~~~~^~~~~~
make: *** [Makefile:23: page-types] Error 1

Trailing ; was forgotten, so add it.

Fixes ece5897e5a10 ("tools/mm: -Werror fixes in page-types/slabinfo")
---
 tools/mm/page-types.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines

tools/mm/page-types.c static void show_page(unsigned long voffset, unsigned long offset, · line 426

Quoted 13 lines
tools/mm/page-types.c +1 -1
index 6eb17cc1a06c5..bcac7ebfb51fd 100644
@@ -420,7 +420,7 @@ static void show_page(unsigned long voffset, unsigned long offset,
 	if (opt_file)
 		printf("%lx\t", voffset);
 	if (opt_list_cgroup)
-		printf("@%" PRIu64 "\t", cgroup)
+		printf("@%" PRIu64 "\t", cgroup);
 	if (opt_list_mapcnt)
 		printf("%" PRIu64 "\t", mapcnt);
 

Just FYI, a very similar patch has posted a few days ago:
https://lore.kernel.org/[email protected]

OK, if the other one is taken, consider adding my Acked-by: then.

Thank you.

Signature · 1 line
Oleksandr Natalenko, MSE