From 44bce1b66c1cdd5308ac3ac773ea0a53d83790fd Mon Sep 17 00:00:00 2001
From: Peter Korsgaard <peter@korsgaard.com>
Date: Tue, 24 Nov 2015 21:16:39 +0100
Subject: [PATCH] LibWebP: fix compilation issue with GCC 5.x / C++11
GCC 5.1 / C++11 gets confused about the "#<TEXT>" in the inline assembly
code, and dies with errors like:
Source/LibWebP/./src/dsp/dsp.upsampling_mips_dsp_r2.c:37:34: error: invalid
character ' ' in raw string delimiter
Fix it by introducting white space around the string literals like it has
been done in upstream webp:
https://chromium.googlesource.com/webm/libwebp/+/eebaf97f5a1cb713d81d311308d8a48c124e5aef
http://sourceforge.net/p/freeimage/discussion/36110/thread/605ef8e4/
[Scripted by sed -i 's/"\(#[A-Z0-9]*\)"/" \1 "/g' *.c]
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Source/LibWebP/src/dsp/dsp.dec_mips_dsp_r2.c | 28 +-
Source/LibWebP/src/dsp/dsp.enc_mips32.c | 314 ++++++++++-----------
Source/LibWebP/src/dsp/dsp.enc_mips_dsp_r2.c | 288 +++++++++----------
Source/LibWebP/src/dsp/dsp.filters_mips_dsp_r2.c | 10 +-
Source/LibWebP/src/dsp/dsp.lossless_mips32.c | 34 +--
Source/LibWebP/src/dsp/dsp.lossless_mips_dsp_r2.c | 8 +-
.../LibWebP/src/dsp/dsp.upsampling_mips_dsp_r2.c | 18 +-
Source/LibWebP/src/dsp/dsp.yuv_mips_dsp_r2.c | 10 +-
8 files changed, 355 insertions(+), 355 deletions(-)
diff --git a/Source/LibWebP/src/dsp/dsp.dec_mips_dsp_r2.c b/Source/LibWebP/src/dsp/dsp.dec_mips_dsp_r2.c
index dac2c93..aaa8111 100644
--- a/Source/LibWebP/src/dsp/dsp.dec_mips_dsp_r2.c
+++ b/Source/LibWebP/src/dsp/dsp.dec_mips_dsp_r2.c
@@ -548,10 +548,10 @@ static void SimpleVFilter16(uint8_t* p, int stride, int thresh) {
// TEMP3 = SRC[D + D1 * BPS]
#define LOAD_4_BYTES(TEMP0, TEMP1, TEMP2, TEMP3, \
A, A1, B, B1, C, C1, D, D1, SRC) \
- "lbu %["#TEMP0"], "#A"+"#A1"*"XSTR(BPS)"(%["#SRC"]) \n\t" \
- "lbu %["#TEMP1"], "#B"+"#B1"*"XSTR(BPS)"(%["#SRC"]) \n\t" \
- "lbu %["#TEMP2"], "#C"+"#C1"*"XSTR(BPS)"(%["#SRC"]) \n\t" \
- "lbu %["#TEMP3"], "#D"+"#D1"*"XSTR(BPS)"(%["#SRC"]) \n\t" \
+ "lbu %[" #TEMP0 "], " #A "+" #A1 "*"XSTR(BPS)"(%[" #SRC "]) \n\t" \
+ "lbu %[" #TEMP1 "], " #B "+" #B1 "*"XSTR(BPS)"(%[" #SRC "]) \n\t" \
+ "lbu %[" #TEMP2 "], " #C "+" #C1 "*"XSTR(BPS)"(%[" #SRC "]) \n\t" \
+ "lbu %[" #TEMP3 "], " #D "+" #D1 "*"XSTR(BPS)"(%[" #SRC "]) \n\t" \
static void SimpleHFilter16(uint8_t* p, int stride, int thresh) {
@@ -623,8 +623,8 @@ static void SimpleHFilter16i(uint8_t* p, int stride, int thresh) {
// DST[B + C * BPS] = TEMP1
#define STORE_8_BYTES(TEMP0, TEMP1, A, B, C, DST) \
- "usw %["#TEMP0"], "#A"*"XSTR(BPS)"(%["#DST"]) \n\t" \
- "usw %["#TEMP1"], "#B"+"#C"*"XSTR(BPS)"(%["#DST"]) \n\t"
+ "usw %[" #TEMP0 "], " #A "*"XSTR(BPS)"(%[" #DST "]) \n\t" \
+ "usw %[" #TEMP1 "], " #B "+" #C "*"XSTR(BPS)"(%[" #DST "]) \n\t"
static void VE4(uint8_t* dst) { // vertical
const uint8_t* top = dst - BPS;
@@ -725,8 +725,8 @@ static void RD4(uint8_t* dst) { // Down-right
// TEMP1 = SRC[B + C * BPS]
#define LOAD_8_BYTES(TEMP0, TEMP1, A, B, C, SRC) \
- "ulw %["#TEMP0"], "#A"*"XSTR(BPS)"(%["#SRC"]) \n\t" \
- "ulw %["#TEMP1"], "#B"+"#C"*"XSTR(BPS)"(%["#SRC"]) \n\t"
+ "ulw %[" #TEMP0 "], " #A "*"XSTR(BPS)"(%[" #SRC "]) \n\t" \
+ "ulw %[" #TEMP1 "], " #B "+" #C "*"XSTR(BPS)"(%[" #SRC "]) \n\t"
static void LD4(uint8_t* dst) { // Down-Left
int temp0, temp1, temp2, temp3, temp4;
@@ -873,24 +873,24 @@ static void DC8uvNoTop(uint8_t* dst) { // DC with no top samples
"preceu.ph.qbl %[temp2], %[temp0] \n\t" \
"preceu.ph.qbr %[temp0], %[temp0] \n\t" \
-".if "#SIZE" == 8 \n\t" \
+".if " #SIZE " == 8 \n\t" \
"preceu.ph.qbl %[temp3], %[temp1] \n\t" \
"preceu.ph.qbr %[temp1], %[temp1] \n\t" \
"addu.ph %[temp2], %[temp2], %[dst_1] \n\t" \
"addu.ph %[temp0], %[temp0], %[dst_1] \n\t" \
-".if "#SIZE" == 8 \n\t" \
+".if " #SIZE " == 8 \n\t" \
"addu.ph %[temp3], %[temp3], %[dst_1] \n\t" \
"addu.ph %[temp1], %[temp1], %[dst_1] \n\t" \
"shll_s.ph %[temp2], %[temp2], 7 \n\t" \
"shll_s.ph %[temp0], %[temp0], 7 \n\t" \
-".if "#SIZE" == 8 \n\t" \