Skip to contentSkip to conversation

fix compiler warnings: use puts() instead of printf()

PATCH Applied Fabio Porcedda 3 participants 8 messages Feb 21, 2013 – Feb 25, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix compiler warnings: use puts() instead of printf()

Use puts() because printf() isn't necessary,
to fix the following compiler warnings:

/barebox/common/menu.c: In function ‘menu_show’:
/barebox/common/menu.c:277:4: warning: format not a string literal and no format arguments [-Wformat-security]

/barebox/scripts/omap4_usbboot.c: In function ‘read_asic_id’:
/barebox/scripts/omap4_usbboot.c:101:3: warning: format not a string literal and no format arguments [-Wformat-security]

Cc Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
Cc Vicente <[email protected]>
---
 common/menu.c           | 2 +-
 scripts/omap4_usbboot.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
common/menu.c +1 -1
index ce93838..30dced7 100644
@@ -274,7 +274,7 @@ int menu_show(struct menu *m)
 			printf("Auto Select in");
 		} else {
 			auto_display_len = strlen(m->auto_display);
-			printf(m->auto_display);
+			puts(m->auto_display);
 		}
 		printf(" %2d", countdown--);
 	}
scripts/omap4_usbboot.c +1 -1
index 8c5775d..34e53c0 100644
@@ -98,7 +98,7 @@ int read_asic_id(struct usb_handle *usb)
 			sprintf(line+4+j*3, "%02X ", id[i+j]);
 		line[4+j*3+0] = '\n';
 		line[4+j*3+1] = 0;
-		printf(line);
+		puts(line);
 	}
 	ret = 0;
 	for (i = 1, j = 0; i < sizeof(id) && j < id[0]; i += 2+id[i+1], j++) {
Signature · 7 lines
1.8.1.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#1 lore raw
Quoted 6 lines · Fabio Porcedda

Use puts() because printf() isn't necessary,
to fix the following compiler warnings:

/barebox/common/menu.c: In function ‘menu_show’:
/barebox/common/menu.c:277:4: warning: format not a string literal and no format arguments [-Wformat-security]

Quoted 6 lines

/barebox/scripts/omap4_usbboot.c: In function ‘read_asic_id’:
/barebox/scripts/omap4_usbboot.c:101:3: warning: format not a string literal and no format arguments [-Wformat-security]

Cc Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
Cc Vicente <[email protected]>

Applied, thanks

Sascha

Quoted 39 lines
---
 common/menu.c           | 2 +-
 scripts/omap4_usbboot.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
common/menu.c +1 -1
index ce93838..30dced7 100644
@@ -274,7 +274,7 @@ int menu_show(struct menu *m)
 			printf("Auto Select in");
 		} else {
 			auto_display_len = strlen(m->auto_display);
-			printf(m->auto_display);
+			puts(m->auto_display);
 		}
 		printf(" %2d", countdown--);
 	}
scripts/omap4_usbboot.c +1 -1
index 8c5775d..34e53c0 100644
@@ -98,7 +98,7 @@ int read_asic_id(struct usb_handle *usb)
 			sprintf(line+4+j*3, "%02X ", id[i+j]);
 		line[4+j*3+0] = '\n';
 		line[4+j*3+1] = 0;
-		printf(line);
+		puts(line);
 	}
 	ret = 0;
 	for (i = 1, j = 0; i < sizeof(id) && j < id[0]; i += 2+id[i+1], j++) {
Signature · 7 lines
1.8.1.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw
In reply to Fabio Porcedda
Quoted 8 lines · Fabio Porcedda

Use puts() because printf() isn't necessary,
to fix the following compiler warnings:

/barebox/common/menu.c: In function ‘menu_show’:
/barebox/common/menu.c:277:4: warning: format not a string literal and no format arguments [-Wformat-security]

/barebox/scripts/omap4_usbboot.c: In function ‘read_asic_id’:
/barebox/scripts/omap4_usbboot.c:101:3: warning: format not a string literal and no format arguments [-Wformat-security]

Sascha revert this please this add a "\n" that we do not want specially on the menu

Best Regards,
J.

Quoted 38 lines
Cc Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
Cc Vicente <[email protected]>
---
 common/menu.c           | 2 +-
 scripts/omap4_usbboot.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
common/menu.c +1 -1
index ce93838..30dced7 100644
@@ -274,7 +274,7 @@ int menu_show(struct menu *m)
 			printf("Auto Select in");
 		} else {
 			auto_display_len = strlen(m->auto_display);
-			printf(m->auto_display);
+			puts(m->auto_display);
 		}
 		printf(" %2d", countdown--);
 	}
scripts/omap4_usbboot.c +1 -1
index 8c5775d..34e53c0 100644
@@ -98,7 +98,7 @@ int read_asic_id(struct usb_handle *usb)
 			sprintf(line+4+j*3, "%02X ", id[i+j]);
 		line[4+j*3+0] = '\n';
 		line[4+j*3+1] = 0;
-		printf(line);
+		puts(line);
 	}
 	ret = 0;
 	for (i = 1, j = 0; i < sizeof(id) && j < id[0]; i += 2+id[i+1], j++) {
Signature · 1 line
1.8.1.1

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#3 lore raw
Quoted 4 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 3 lines · Fabio Porcedda

Use puts() because printf() isn't necessary,
to fix the following compiler warnings:

Quoted 8 lines
Quoted 5 lines

/barebox/common/menu.c: In function ‘menu_show’:
/barebox/common/menu.c:277:4: warning: format not a string literal and no format arguments [-Wformat-security]

/barebox/scripts/omap4_usbboot.c: In function ‘read_asic_id’:
/barebox/scripts/omap4_usbboot.c:101:3: warning: format not a string literal and no format arguments [-Wformat-security]

Sascha revert this please this add a "\n" that we do not want specially on the menu

I've already sent a patch to fix the newline problem and the warning too. Reverting the patch doesn't fix the warning.

Best regards
Fabio Porcedda

Quoted 40 lines

Best Regards,
J.

Quoted 38 lines
Cc Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
Cc Vicente <[email protected]>
---
 common/menu.c           | 2 +-
 scripts/omap4_usbboot.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
common/menu.c +1 -1
index ce93838..30dced7 100644
@@ -274,7 +274,7 @@ int menu_show(struct menu *m)
                      printf("Auto Select in");
              } else {
                      auto_display_len = strlen(m->auto_display);
-                     printf(m->auto_display);
+                     puts(m->auto_display);
              }
              printf(" %2d", countdown--);
      }
scripts/omap4_usbboot.c +1 -2
index 8c5775d..34e53c0 100644
@@ -98,7 +98,7 @@ int read_asic_id(struct usb_handle *usb)
                      sprintf(line+4+j*3, "%02X ", id[i+j]);
              line[4+j*3+0] = '\n';
              line[4+j*3+1] = 0;
-             printf(line);
+             puts(line);
      }
      ret = 0;
      for (i = 1, j = 0; i < sizeof(id) && j < id[0]; i += 2+id[i+1], j++) {
--

1.8.1.1

Signature · 6 lines
Fabio Porcedda

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw
Quoted 9 lines · Fabio Porcedda
Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 6 lines · Fabio Porcedda

Use puts() because printf() isn't necessary,
to fix the following compiler warnings:

/barebox/common/menu.c: In function ‘menu_show’:
/barebox/common/menu.c:277:4: warning: format not a string literal and no format arguments [-Wformat-security]

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

/barebox/scripts/omap4_usbboot.c: In function ‘read_asic_id’:
/barebox/scripts/omap4_usbboot.c:101:3: warning: format not a string literal and no format arguments [-Wformat-security]

Sascha revert this please this add a "\n" that we do not want specially on the menu

I've already sent a patch to fix the newline problem and the warning too. Reverting the patch doesn't fix the warning.

the patch is wrong we revert you send the write one

Best Regards,
J.

Quoted 36 lines

Best regards
Fabio Porcedda

Quoted 32 lines

Best Regards,
J.

Quoted 30 lines
Cc Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
Cc Vicente <[email protected]>
---
 common/menu.c           | 2 +-
 scripts/omap4_usbboot.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
common/menu.c +1 -1
index ce93838..30dced7 100644
@@ -274,7 +274,7 @@ int menu_show(struct menu *m)
                      printf("Auto Select in");
              } else {
                      auto_display_len = strlen(m->auto_display);
-                     printf(m->auto_display);
+                     puts(m->auto_display);
              }
              printf(" %2d", countdown--);
      }
scripts/omap4_usbboot.c +0 -0
index 8c5775d..34e53c0 100644
@@ -98,7 +98,7 @@ int read_asic_id(struct usb_handle *usb)
                      sprintf(line+4+j*3, "%02X ", id[i+j]);
              line[4+j*3+0] = '\n';
              line[4+j*3+1] = 0;
Quoted 13 lines
Quoted 8 lines
Quoted 8 lines
scripts/omap4_usbboot.c +1 -2
-             printf(line);
+             puts(line);
      }
      ret = 0;
      for (i = 1, j = 0; i < sizeof(id) && j < id[0]; i += 2+id[i+1], j++) {
--

1.8.1.1

Signature · 1 line
Fabio Porcedda

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#5 lore raw
Quoted 13 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 12 lines · Fabio Porcedda
Quoted 10 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 8 lines · Fabio Porcedda

Use puts() because printf() isn't necessary,
to fix the following compiler warnings:

/barebox/common/menu.c: In function ‘menu_show’:
/barebox/common/menu.c:277:4: warning: format not a string literal and no format arguments [-Wformat-security]

/barebox/scripts/omap4_usbboot.c: In function ‘read_asic_id’:
/barebox/scripts/omap4_usbboot.c:101:3: warning: format not a string literal and no format arguments [-Wformat-security]

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

Sascha revert this please this add a "\n" that we do not want specially on the menu

I've already sent a patch to fix the newline problem and the warning too. Reverting the patch doesn't fix the warning.

the patch is wrong we revert you send the write one

I understand that the patch is wrong but the patch cannot be simply reverted because in master there is already a partial fix for it:
"OMAP4 USB BOOT: remove double line endings".

Only half of the patch can be reverted but instead of reverting it we can fix it.
I've already sent the patch to fix the remaining part:
" menu: fix remove superfluous newline: change puts() -> printf("%s, )"

What do you think about that patch?

Best regards
Fabio Porcedda

Quoted 51 lines

Best Regards,
J.

Quoted 49 lines

Best regards
Fabio Porcedda

Quoted 32 lines

Best Regards,
J.

Quoted 30 lines
Cc Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
Cc Vicente <[email protected]>
---
 common/menu.c           | 2 +-
 scripts/omap4_usbboot.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
common/menu.c +1 -1
index ce93838..30dced7 100644
@@ -274,7 +274,7 @@ int menu_show(struct menu *m)
                      printf("Auto Select in");
              } else {
                      auto_display_len = strlen(m->auto_display);
-                     printf(m->auto_display);
+                     puts(m->auto_display);
              }
              printf(" %2d", countdown--);
      }
scripts/omap4_usbboot.c +0 -0
index 8c5775d..34e53c0 100644
@@ -98,7 +98,7 @@ int read_asic_id(struct usb_handle *usb)
                      sprintf(line+4+j*3, "%02X ", id[i+j]);
              line[4+j*3+0] = '\n';
              line[4+j*3+1] = 0;
Quoted 8 lines
Quoted 8 lines
scripts/omap4_usbboot.c +1 -2
-             printf(line);
+             puts(line);
      }
      ret = 0;
      for (i = 1, j = 0; i < sizeof(id) && j < id[0]; i += 2+id[i+1], j++) {
--

1.8.1.1

--
Fabio Porcedda

--
Fabio Porcedda

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#6 lore raw
Quoted 26 lines · Fabio Porcedda
Quoted 13 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 12 lines · Fabio Porcedda
Quoted 10 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 8 lines · Fabio Porcedda

Use puts() because printf() isn't necessary,
to fix the following compiler warnings:

/barebox/common/menu.c: In function ‘menu_show’:
/barebox/common/menu.c:277:4: warning: format not a string literal and no format arguments [-Wformat-security]

/barebox/scripts/omap4_usbboot.c: In function ‘read_asic_id’:
/barebox/scripts/omap4_usbboot.c:101:3: warning: format not a string literal and no format arguments [-Wformat-security]

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

Sascha revert this please this add a "\n" that we do not want specially on the menu

I've already sent a patch to fix the newline problem and the warning too. Reverting the patch doesn't fix the warning.

the patch is wrong we revert you send the write one

I understand that the patch is wrong but the patch cannot be simply reverted because in master there is already a partial fix for it:
"OMAP4 USB BOOT: remove double line endings".

Quoted 6 lines

Only half of the patch can be reverted but instead of reverting it we can fix it.
I've already sent the patch to fix the remaining part:
" menu: fix remove superfluous newline: change puts() -> printf("%s, )"

What do you think about that patch?

I'm sorry NACK this break git bisect not acceptable

for just warnings

Best Regards,
J.

Quoted 58 lines

Best regards
Fabio Porcedda

Quoted 51 lines

Best Regards,
J.

Quoted 49 lines

Best regards
Fabio Porcedda

Quoted 32 lines

Best Regards,
J.

Quoted 30 lines
Cc Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
Cc Vicente <[email protected]>
---
 common/menu.c           | 2 +-
 scripts/omap4_usbboot.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
common/menu.c +1 -1
index ce93838..30dced7 100644
@@ -274,7 +274,7 @@ int menu_show(struct menu *m)
                      printf("Auto Select in");
              } else {
                      auto_display_len = strlen(m->auto_display);
-                     printf(m->auto_display);
+                     puts(m->auto_display);
              }
              printf(" %2d", countdown--);
      }
scripts/omap4_usbboot.c +0 -0
index 8c5775d..34e53c0 100644
@@ -98,7 +98,7 @@ int read_asic_id(struct usb_handle *usb)
                      sprintf(line+4+j*3, "%02X ", id[i+j]);
              line[4+j*3+0] = '\n';
              line[4+j*3+1] = 0;
Quoted 8 lines
Quoted 8 lines
scripts/omap4_usbboot.c +1 -2
-             printf(line);
+             puts(line);
      }
      ret = 0;
      for (i = 1, j = 0; i < sizeof(id) && j < id[0]; i += 2+id[i+1], j++) {
--

1.8.1.1

--
Fabio Porcedda

Quoted 2 lines

--
Fabio Porcedda

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#7 lore raw
Quoted 32 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 31 lines · Fabio Porcedda
Quoted 13 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 12 lines · Fabio Porcedda
Quoted 10 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 8 lines · Fabio Porcedda

Use puts() because printf() isn't necessary,
to fix the following compiler warnings:

/barebox/common/menu.c: In function ‘menu_show’:
/barebox/common/menu.c:277:4: warning: format not a string literal and no format arguments [-Wformat-security]

/barebox/scripts/omap4_usbboot.c: In function ‘read_asic_id’:
/barebox/scripts/omap4_usbboot.c:101:3: warning: format not a string literal and no format arguments [-Wformat-security]

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

Sascha revert this please this add a "\n" that we do not want specially on the menu

I've already sent a patch to fix the newline problem and the warning too. Reverting the patch doesn't fix the warning.

the patch is wrong we revert you send the write one

I understand that the patch is wrong but the patch cannot be simply reverted because in master there is already a partial fix for it:
"OMAP4 USB BOOT: remove double line endings".

Only half of the patch can be reverted but instead of reverting it we can fix it.
I've already sent the patch to fix the remaining part:
" menu: fix remove superfluous newline: change puts() -> printf("%s, )"

Quoted 5 lines
Quoted 1 line

What do you think about that patch?

I'm sorry NACK this break git bisect not acceptable

for just warnings

You are right but the patch is already in branch master:
http://git.pengutronix.de/?p=barebox.git;a=commit;h=638f91bd166fe4aa8ee7c046c6102dab6d44ee0b

Only a git rebase -i can change that, but a rebase is not good for master.

Best regards
Fabio Porcedda

Quoted 62 lines

Best Regards,
J.

Quoted 60 lines

Best regards
Fabio Porcedda

Quoted 51 lines

Best Regards,
J.

Quoted 49 lines

Best regards
Fabio Porcedda

Quoted 32 lines

Best Regards,
J.

Quoted 30 lines
Cc Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
Cc Vicente <[email protected]>
---
 common/menu.c           | 2 +-
 scripts/omap4_usbboot.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
common/menu.c +1 -1
index ce93838..30dced7 100644
@@ -274,7 +274,7 @@ int menu_show(struct menu *m)
                      printf("Auto Select in");
              } else {
                      auto_display_len = strlen(m->auto_display);
-                     printf(m->auto_display);
+                     puts(m->auto_display);
              }
              printf(" %2d", countdown--);
      }
scripts/omap4_usbboot.c +0 -0
index 8c5775d..34e53c0 100644
@@ -98,7 +98,7 @@ int read_asic_id(struct usb_handle *usb)
                      sprintf(line+4+j*3, "%02X ", id[i+j]);
              line[4+j*3+0] = '\n';
              line[4+j*3+1] = 0;
Quoted 8 lines
Quoted 8 lines
scripts/omap4_usbboot.c +1 -2
-             printf(line);
+             puts(line);
      }
      ret = 0;
      for (i = 1, j = 0; i < sizeof(id) && j < id[0]; i += 2+id[i+1], j++) {
--

1.8.1.1

--
Fabio Porcedda

--
Fabio Porcedda

--
Fabio Porcedda

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox