Euphoria Ticket #129: translator not setting ifdef symbols correctly on some targets:

On Windows:

The command:

E:\euphoria\bin\euc.exe -nobuild -wat -plat FREEBSD -D EU_MANAGED_MEM -i E:\euphoria\include E:\euphoria\source\int.ex

Results in: E:\euphoria\include\std\os.e:107 <0120>:: no value returned from function end function

And that is so also if you supply LINUX instead of FREEBSD

On the other hand, if you supply NETBSD: E:\euphoria\bin\euc.exe -nobuild -wat -plat NETBSD -D EU_MANAGED_MEM -i E:\euphoria\include E:\euphoria\source\int.ex E:\euphoria\include\std\filesys.e:72 <0031>:: attempt to redefine xMoveFile. constant xMoveFile = define_c_func(lib, "rename", {C_POINTER, C_POINTER}, C_INT)

Details

Type: Bug Report Severity: Major Category: Translator
Assigned To: mattlewis Status: Fixed Reported Release: 3050
Fixed in SVN #: 3346, 3071 View VCS: 3346, 3071 Milestone:

1. Comment by ne1uno Feb 02, 2010

I noticed the same thing with MANAGEDD_MEM, but I assumed the recent addition of ALIGN4 was somehow the cause although I saw nothing alarming in the diffs. it seems like a random error with translations of different programs.

2. Comment by DerekParnell Feb 02, 2010

Can you give more detail on what you mean by "I noticed the same thing with MANAGED_MEM"?

3. Comment by mattlewis Feb 02, 2010

set_host_platform() is being called before GetPlatformDefines(), so the platform modification is never seen.

As this is only a cross-translation issue, I'm also downgrading from Blocking to Major (since we're still in beta).

4. Comment by mattlewis Feb 02, 2010

Actually, the problem appears to be the strange way we have the various unix-like constants defined. Can anyone say why Linux and FreeBSD are 3.3 and 8.4, respectively? The others are all integers. The end result appears to be that set_host_platform() doesn't work correctly for these two targets.

5. Comment by jimcbrown Feb 02, 2010

Where are you seeing 8.4 and 3.3 ? I can't find it in the source.

In platform.e we did define all the Unix systems as atoms for historical reasons (back when LINUX = FREEBSD = OSX = SUNOS = .... because we needed a way to tell them apart when cross translating) but that can all go away now.

6. Comment by ne1uno Feb 03, 2010

by DerekParnell 20 hours ago
Can you give more detail on what you mean >> by "I noticed the same thing with MANAGED_MEM"?

with managed_mem and align4 defined on win98, necessary to get a usable executable, I get what appear to be random syntax errors when translating anything.

may or may not be related to the current tic ket.

7. Comment by DerekParnell Feb 03, 2010

I can't reproduce the problem. When I use MANAGED_MEM and ALIGN4 I don't get any problems.

Can you show me an example of the syntax errors you are getting?

8. Comment by mattlewis Feb 03, 2010

In platform.e:

public constant 
	ULINUX = LINUX + 0.3, 
	UFREEBSD = FREEBSD + 0.4, 
	UOSX = OSX, 
	USUNOS = SUNOS, 
	UOPENBSD = OPENBSD, 
	UNETBSD = NETBSD 

...then, later:

sequence unices = {ULINUX, UFREEBSD, UOSX, USUNOS, UOPENBSD, UNETBSD} 
public procedure set_host_platform( atom plat ) 
	ihost_platform = floor(plat) 
 
	TUNIX    = (find(ihost_platform, unices) != 0)  
	TWINDOWS = (ihost_platform = WIN32) 
	TBSD     = (ihost_platform = UFREEBSD) 
	TOSX     = (ihost_platform = UOSX) 
	TLINUX   = (ihost_platform = ULINUX) 
	TSUNOS   = (ihost_platform = USUNOS) 
	TOPENBSD = (ihost_platform = UOPENBSD) 
	TNETBSD  = (ihost_platform = UNETBSD) 
	IUNIX    = TUNIX 
	IWINDOWS = TWINDOWS 
	IBSD     = TBSD 
	IOSX     = TOSX 
	ILINUX   = TLINUX 
	ISUNOS   = TSUNOS 
	IOPENBSD = TOPENBSD 
	INETBSD  = TNETBSD 
 
	if TUNIX then 
		HOSTNL = "\n" 
	else 
		HOSTNL = "\r\n" 
	end if 
end procedure 

So after flooring the platform value, we use the non-integral constant for comparisons.

9. Comment by mattlewis Feb 03, 2010

I changed the constants to integers. The only place they're used is in setting the host platform, where the non-integers were clearly wrong.

10. Comment by jimcbrown Feb 03, 2010

I see this in platform.e

public constant 
        ULINUX = LINUX + 0.3, 
        UFREEBSD = FREEBSD + 0.4, 
        UOSX = OSX + 0.5, 
        USUNOS = SUNOS + 0.6, 
        UOPENBSD = OPENBSD + 0.7, 
        UNETBSD = NETBSD + 0.8, 

i.e. it's all the unixes. This was correct when the code was first implemented.

But all the U* constants probably should just go away, as they are obsolete now.

11. Comment by SPringle Aug 11, 2010

I eliminated the U* constants in the branch involving the -ARCH feature. It was a search and replace and then an edit to remove the constant definitions. They go away without a problem.

One has to try translating to various other platforms to confirm that the ifdefs are right in the various dot-e files.

12. Comment by SPringle Aug 11, 2010

cross translation now works. It would be nice to know if the source code it creates compiles and works on platforms other than WIN32 and LINUX.

13. Comment by ne1uno Aug 12, 2010

the watcom config and makefile needs to enable the source option for gcc if that wasn't fixed since 3320. I had to edit makefile.wat

# -nobuild -gcc  -nobuild -wat  edit 2 places 
CCOM=gcc 
LIBEXT=a 
since it was intended for minGW, the OS define word was already correct.

14. Comment by mattlewis Aug 12, 2010

Putting two different compilers in the command line seems...wrong. Based on Shawn's comment, I'm going to close this. We can open other tickets for more specific issues.

Search



Quick Links

User menu

Not signed in.

Misc Menu