Bug 172300 - [patch] multimedia/w_scan fails to build using clang
[patch] multimedia/w_scan fails to build using clang
Status: Closed FIXED
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s)
Latest
Any Any
: Normal Affects Only Me
Assigned To: Juergen Lock
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-03 11:50 UTC by magyarimiki
Modified: 2012-10-03 16:40 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description magyarimiki 2012-10-03 11:50:08 UTC
multimedia/w_scan fails to build using clang:

[...snip...]

===>  Building for w_scan-20120415
make  all-am
clang -DHAVE_CONFIG_H -I.    -I/usr/local/include -Wall -Wextra -Wno-comment -Wswitch-default -Wno-unused-parameter -O2 -pipe -fno-strict-aliasing -MT atsc_psip_section.o -MD -MP -MF .deps/atsc_psip_section.Tpo -c -o atsc_psip_section.o atsc_psip_section.c
clang -DHAVE_CONFIG_H -I.    -I/usr/local/include -Wall -Wextra -Wno-comment -Wswitch-default -Wno-unused-parameter -O2 -pipe -fno-strict-aliasing -MT countries.o -MD -MP -MF .deps/countries.Tpo -c -o countries.o countries.c
countries.c:561:19: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
mv -f .deps/atsc_psip_section.Tpo .deps/atsc_psip_section.Po
       {"AX", AX, "<C5>LAND ISLANDS"},                                /*ALA, 248},*/
                  ^
countries.c:614:19: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
       {"CI", CI, "C<D4>TE D'IVOIRE"},                                /*CIV, 384},*/
                  ^
countries.c:617:19: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
       {"CW", CW, "CURA<C7>AO"},                                      /*CUW, 531},*/
                  ^
countries.c:740:19: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
       {"RE", RE, "R<C9>UNION"},                                      /*REU, 638},*/
                  ^
countries.c:744:19: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
       {"BL", BL, "SAINT BARTH<C9>LEMY"},                             /*BLM, 652},*/
                  ^
clang -DHAVE_CONFIG_H -I.    -I/usr/local/include -Wall -Wextra -Wno-comment -Wswitch-default -Wno-unused-parameter -O2 -pipe -fno-strict-aliasing -MT descriptors.o -MD -MP -MF .deps/descriptors.Tpo -c -o descriptors.o descriptors.c
descriptors.c:1014:40: error: expected ';' at end of declaration
        uint8_t LeapYear(uint16_t year) {
                                       ^
                                       ;
1 error generated.
*** [descriptors.o] Error code 1
5 warnings generated.
mv -f .deps/countries.Tpo .deps/countries.Po
1 error
*** [all] Error code 2
1 error
*** [do-build] Error code 1

Stop in /usr/ports/multimedia/w_scan.
*** [build] Error code 1

Stop in /usr/ports/multimedia/w_scan.

Fix: The code is using gnu C extensions. The following new patchfile under files/ fixes the issue:

# cat files/patch-descriptors.c


+__u8 LeapYear(__u16 year) {
+     if ((year % 400) == 0)
+       return 1;
+     else if ((year % 100) == 0)
+       return 0;
+     else if ((year % 4) == 0)
+       return 1;
+     return 0;
+}
+

 /* 300468 v011101 annex C, Conversion between time and date conventions
  * NOTE: These formulas are applicable between the inclusive dates 1900 March 1 to 2100 February 28.
@@ -1011,16 +1021,6 @@
         int _M = (int) (MJD - 14956.1 - (int) (_Y * 365.25)) / 30.6001;
         int K = (_M == 14) ? 1 : (_M == 15) ? 1 : 0;

-        __u8 LeapYear(__u16 year) {
-             if ((year % 400) == 0)
-                return 1;
-             else if ((year % 100) == 0)
-                return 0;
-             else if ((year % 4) == 0)
-                return 1;
-             return 0;
-        }
-
         memset(&utc, 0, sizeof(struct tm));
         utc.tm_mday = MJD - 14956 - (int) (_Y * 365.25) - (int) (_M * 30.6001);
         utc.tm_year = _Y + K;--ZCtOpIktXnQJw5NaO2lVgZ40PSApXcIR9LFd5r3G7fYeAggC
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- descriptors.c.orig  2012-10-03 12:39:42.000000000 +0200
+++ descriptors.c       2012-10-03 12:39:56.000000000 +0200
@@ -1000,6 +1000,16 @@
               }
 }
How-To-Repeat: # cd /usr/ports/multimedia/w_scan
# make
Comment 1 Edwin Groothuis freebsd_committer 2012-10-03 11:50:20 UTC
Responsible Changed
From-To: freebsd-ports-bugs->nox

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 dfilter freebsd_committer 2012-10-03 16:38:29 UTC
Author: nox
Date: Wed Oct  3 15:38:19 2012
New Revision: 305207
URL: http://svn.freebsd.org/changeset/ports/305207

Log:
  Fix build with clang.
  
  PR:		ports/172300
  Submitted by:	Miklos Magyari <magyarimiki@gmail.com>

Added:
  head/multimedia/w_scan/files/patch-clang   (contents, props changed)

Added: head/multimedia/w_scan/files/patch-clang
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/multimedia/w_scan/files/patch-clang	Wed Oct  3 15:38:19 2012	(r305207)
@@ -0,0 +1,41 @@
+The code is using gnu C extensions. The following new patchfile under files/ fixes the issue:
+
+# cat files/patch-descriptors.c
+--- a/descriptors.c       2012-10-03 12:39:42.000000000 +0200
++++ b/descriptors.c       2012-10-03 12:39:56.000000000 +0200
+@@ -1000,6 +1000,16 @@
+               }
+ }
+ 
++__u8 LeapYear(__u16 year) {
++     if ((year % 400) == 0)
++       return 1;
++     else if ((year % 100) == 0)
++       return 0;
++     else if ((year % 4) == 0)
++       return 1;
++     return 0;
++}
++
+ 
+ /* 300468 v011101 annex C, Conversion between time and date conventions
+  * NOTE: These formulas are applicable between the inclusive dates 1900 March 1 to 2100 February 28.
+@@ -1011,16 +1021,6 @@
+         int _M = (int) (MJD - 14956.1 - (int) (_Y * 365.25)) / 30.6001;
+         int K = (_M == 14) ? 1 : (_M == 15) ? 1 : 0;
+ 
+-        __u8 LeapYear(__u16 year) {
+-             if ((year % 400) == 0)
+-                return 1;
+-             else if ((year % 100) == 0)
+-                return 0;
+-             else if ((year % 4) == 0)
+-                return 1;
+-             return 0;
+-        }
+-        
+         memset(&utc, 0, sizeof(struct tm));
+         utc.tm_mday = MJD - 14956 - (int) (_Y * 365.25) - (int) (_M * 30.6001);
+         utc.tm_year = _Y + K;
+ 
+ 
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 3 Juergen Lock freebsd_committer 2012-10-03 16:39:50 UTC
State Changed
From-To: open->closed

Committed. Thanks!