humbi83 / lz4

Automatically exported from code.google.com/p/lz4
0 stars 0 forks source link

Can't build lz4.c/h using Sun Studio 12 C compiler when lz4.c/h has Dos (Cr/LF) line endings #82

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Save/unpack lz4.c/h on a Windows system
2. Copy to Unix share
3. Compile on Solaris machine using Sun Studio compiler 

What is the expected output? What do you see instead?

Expected: Successful compilation:

What I see: 
"../lz4.c", line 42: warning: invalid white space character in directive
"../lz4.c", line 47: warning: invalid white space character in directive
"../lz4.c", line 54: warning: invalid white space character in directive
"../lz4.c", line 54: token not allowed in directive: \
"../lz4.c", line 55: syntax error before or at: ||"
<snip>

What version of the product are you using? On what operating system?
lz4 rev101,  Solaris Sparc/x86 with Sun Studio 12.3

Please provide any additional information below.

Further description of issue: https://forums.oracle.com/message/10489755

My current workaround: 
dos2unix conversion of lz4.c/h, manual fix of pragma pack choice

Another possible workaround, using the c++ compiler to build lz4.c (the c++ 
compiler can handle line continuations in Macros) leads to followup error, 
caused by malformed pragma (see issue 81)

Possible fix: Don't use line continuations in Macro

Original issue reported on code.google.com by oliver.s...@gmail.com on 21 Aug 2013 at 12:41

GoogleCodeExporter commented 8 years ago
So, it's a combination of issues ?

Using line continuations '\' for macros,
editing using a Windows-based, with CRLF end of line convention,
and compiling the unmodified source using Sun Studio on Solaris Sparc.

Quite unfortunate set of circumstances.

If that is the case, a tool converting EoL convention from Windows to Unix 
might do the trick. Heck, maybe SVN can do that automatically.

Not using line continuation may hurt code readability, which is also important.
I'll look into it, and see if it's worth abandoning it.

Original comment by yann.col...@gmail.com on 21 Aug 2013 at 1:56

GoogleCodeExporter commented 8 years ago
Coming back to this issue ; I've you found a way to use windows-edited source 
files with Sun Studio ? For example by converting End-of-Line convention from 
Windows to Unix ?

Original comment by yann.col...@gmail.com on 7 Sep 2013 at 7:32

GoogleCodeExporter commented 8 years ago
Keeping very long #define on a single line would result in too long lines, 
breaking code readability practices.
Prefer using a tool to convert Windows convention EoL into Solaris convention 
EoL.

Original comment by yann.col...@gmail.com on 22 Sep 2013 at 1:17