]> rtime.felk.cvut.cz Git - coffee/buildroot.git/commitdiff
package/urg: fix build with gcc-6
authorSamuel Martin <s.martin49@gmail.com>
Mon, 12 Sep 2016 19:23:23 +0000 (21:23 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sat, 15 Oct 2016 10:23:39 +0000 (12:23 +0200)
Add patch fixing/adding explicit cast on negative value in char[], which
is required with gcc-6 (see "Narrowing conversions" paragraph in [1])

Fixes:
  http://autobuild.buildroot.net/results/d0c/d0cd11163753db69a14c02e941dbda40e5f98bba/

[1] https://gcc.gnu.org/gcc-6/porting_to.html

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/urg/0002-urg-gcc6-fix-narrowing-conversion.patch [new file with mode: 0644]

diff --git a/package/urg/0002-urg-gcc6-fix-narrowing-conversion.patch b/package/urg/0002-urg-gcc6-fix-narrowing-conversion.patch
new file mode 100644 (file)
index 0000000..e3db898
--- /dev/null
@@ -0,0 +1,99 @@
+urg: fix 'narrowing conversion' with gcc6
+
+Fixes:
+  http://autobuild.buildroot.net/results/d0c/d0cd11163753db69a14c02e941dbda40e5f98bba/
+
+Signed-off-by: Samuel Martin <s.martin49@gmail.com>
+
+--- a/src/cpp/urg/ScipHandler.cpp      2016-09-11 16:11:16.083995214 +0200
++++ b/src/cpp/urg/ScipHandler.cpp      2016-09-11 16:11:24.380832543 +0200
+@@ -120,7 +120,7 @@ struct ScipHandler::pImpl
\r
+       // QT \82Ì\94­\8ds\r
+       int return_code = -1;\r
+-      char qt_expected_response[] = { 0, -1 };\r
++      char qt_expected_response[] = { 0, (char)-1 };\r
+       // return_code \82ð\8eg\82¢\82½\82¢\82½\82ß\81AsetLaserOutput() \82ð\97p\82¢\82¸\82É QT \82ð\91\97\90M\82·\82é\r
+       if (response(return_code, "QT\n", qt_expected_response)) {\r
+         laser_state_ = LaserOff;\r
+@@ -139,7 +139,7 @@ struct ScipHandler::pImpl
\r
+       } else if (return_code == Scip11Response) {\r
+         // SCIP1.1 \83v\83\8d\83g\83R\83\8b\82Ì\8fê\8d\87\82Ì\82Ý\81ASCIP2.0 \82ð\91\97\90M\82·\82é\r
+-        char scip20_expected_response[] = { 0, -1 };\r
++        char scip20_expected_response[] = { 0, (char)-1 };\r
+         if (! response(return_code, "SCIP2.0\n", scip20_expected_response)) {\r
+           error_message_ =\r
+             "SCIP1.1 protocol is not supported. Please update URG firmware, or reconnect after a few seconds because sensor is booting.";\r
+@@ -150,7 +150,7 @@ struct ScipHandler::pImpl
\r
+       } else if (return_code == 0xE) {\r
+         // TM \83\82\81[\83h\82Æ\82Ý\82È\82µ\81ATM2 \82ð\94­\8ds\82·\82é\r
+-        char tm2_expected_response[] = { 0, -1 };\r
++        char tm2_expected_response[] = { 0, (char)-1 };\r
+         if (response(return_code, "TM2\n", tm2_expected_response)) {\r
+           laser_state_ = LaserOff;\r
+           return changeBothBaudrate(baudrate);\r
+@@ -202,7 +202,7 @@ struct ScipHandler::pImpl
+     snprintf(send_buffer, 10, "SS%06ld\n", baudrate);\r
+     int return_code = -1;\r
+     // !!! \8aù\82É\90Ý\92è\91Î\8fÛ\82Ì\83{\81[\83\8c\81[\83g\81A\82Ì\8fê\8d\87\82Ì\96ß\82è\92l\82ð ss_expected... \82É\92Ç\89Á\82·\82é\r
+-    char ss_expected_response[] = { 0, 0x3, 0x4, 0xf, -1 };\r
++    char ss_expected_response[] = { 0, 0x3, 0x4, 0xf, (char)-1 };\r
+     if (! response(return_code, send_buffer, ss_expected_response)) {\r
+       error_message_ = "Baudrate change fail.";\r
+       return false;\r
+@@ -216,7 +216,7 @@ struct ScipHandler::pImpl
+   {\r
+     // PP \82Ì\91\97\90M\82Æ\83f\81[\83^\82Ì\8eó\90M\r
+     int return_code = -1;\r
+-    char pp_expected_response[] = { 0, -1 };\r
++    char pp_expected_response[] = { 0, (char)-1 };\r
+     vector<string> lines;\r
+     if (! response(return_code, "PP\n", pp_expected_response, &lines)) {\r
+       error_message_ = "PP fail.";\r
+@@ -356,7 +356,7 @@ struct ScipHandler::pImpl
\r
+     if (on) {\r
+       int return_code = -1;\r
+-      char expected_response[] = { 0, -1 };\r
++      char expected_response[] = { 0, (char)-1 };\r
+       if (! response(return_code, "BM\n", expected_response)) {\r
+         error_message_ = "BM fail.";\r
+         return false;\r
+@@ -369,7 +369,7 @@ struct ScipHandler::pImpl
+       if (! mx_capturing_) {\r
+         // \8fÁ\93\94\82·\82é\82½\82ß\82Ì QT \82Å\82Í\81A\89\9e\93\9a\82ð\91Ò\82Â\82×\82«\r
+         int return_code = -1;\r
+-        char qt_expected_response[] = { 0, -1 };\r
++        char qt_expected_response[] = { 0, (char)-1 };\r
+         if (! response(return_code, "QT\n", qt_expected_response)) {\r
+           return false;\r
+         }\r
+@@ -777,7 +777,7 @@ bool ScipHandler::loadParameter(RangeSen
+ bool ScipHandler::versionLines(vector<string>& lines)\r
+ {\r
+   int return_code = -1;\r
+-  char expected_response[] = { 0, -1 };\r
++  char expected_response[] = { 0, (char)-1 };\r
+   if (! pimpl->response(return_code, "VV\n", expected_response, &lines)) {\r
+     return false;\r
+   }\r
+@@ -792,7 +792,7 @@ bool ScipHandler::setRawTimestampMode(bo
\r
+   // TM0 or TM2 \82Ì\91\97\90M\r
+   int return_code = -1;\r
+-  char expected_response[] = { 0, -1 };\r
++  char expected_response[] = { 0, (char)-1 };\r
+   if (! pimpl->response(return_code, send_command, expected_response)) {\r
+     pimpl->error_message_ = (on) ? "TM0 fail." : "TM2 fail.";\r
+     return false;\r
+@@ -809,7 +809,7 @@ bool ScipHandler::rawTimestamp(int* time
+ {\r
+   // TM1 \82Ì\92l\82ð\95Ô\82·\r
+   int return_code = -1;\r
+-  char expected_response[] = { 0, -1 };\r
++  char expected_response[] = { 0, (char)-1 };\r
+   vector<string> lines;\r
+   if (! pimpl->response(return_code, "TM1\n", expected_response, &lines)) {\r
+     pimpl->error_message_ = "TM1 fail.";\r