microblaze: use strverscmp() in MICROBLAZE_VERSION_COMPARE()

Message ID 20221016181531.225006-1-ovpanait@gmail.com
State Accepted
Headers
Series microblaze: use strverscmp() in MICROBLAZE_VERSION_COMPARE() |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Ovidiu Panait Oct. 16, 2022, 6:15 p.m. UTC
  Currently, combining '-mxl-multiply-high' with -mcpu=v11.0 produces the
following bogus warning:

  echo "int main(){}" | ./microblazeel-linux-gnu-gcc -mxl-multiply-high \
  -mno-xl-soft-mul -mcpu=v11.0 -nostdlib -x c -
  warning: '-mxl-multiply-high' can be used only with '-mcpu=v6.00.a' or greater

Since strcasecmp() doesn't properly compare single-digit cpu versions with
double-digit versions, switch MICROBLAZE_VERSION_COMPARE() to use strverscmp()
instead.

	* config/microblaze/microblaze.cc (MICROBLAZE_VERSION_COMPARE): Use
	strverscmp() to fix bogus warnings when passing multi-digit -mcpu
	versions on the command line.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
---
 gcc/config/microblaze/microblaze.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Jeff Law Oct. 24, 2022, 3:18 p.m. UTC | #1
On 10/16/22 12:15, Ovidiu Panait via Gcc-patches wrote:
> Currently, combining '-mxl-multiply-high' with -mcpu=v11.0 produces the
> following bogus warning:
>
>    echo "int main(){}" | ./microblazeel-linux-gnu-gcc -mxl-multiply-high \
>    -mno-xl-soft-mul -mcpu=v11.0 -nostdlib -x c -
>    warning: '-mxl-multiply-high' can be used only with '-mcpu=v6.00.a' or greater
>
> Since strcasecmp() doesn't properly compare single-digit cpu versions with
> double-digit versions, switch MICROBLAZE_VERSION_COMPARE() to use strverscmp()
> instead.
>
> 	* config/microblaze/microblaze.cc (MICROBLAZE_VERSION_COMPARE): Use
> 	strverscmp() to fix bogus warnings when passing multi-digit -mcpu
> 	versions on the command line.

But strverscmp doesn't ignore character case.  ISTM that you need to 
canonicalize the case first if you're going to use strverscmp.


Jeff
  

Patch

diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc
index 8fcca1829f6..28a2a9596d1 100644
--- a/gcc/config/microblaze/microblaze.cc
+++ b/gcc/config/microblaze/microblaze.cc
@@ -56,7 +56,7 @@ 
 /* This file should be included last.  */
 #include "target-def.h"
 
-#define MICROBLAZE_VERSION_COMPARE(VA,VB) strcasecmp (VA, VB)
+#define MICROBLAZE_VERSION_COMPARE(VA,VB) strverscmp (VA, VB)
 
 /* Classifies an address.