English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 06 March 2024, 12:47   #1541
Olaf Barthel
Registered User
 
Join Date: Aug 2010
Location: Germany
Posts: 532
Quote:
Originally Posted by Mafi View Post

...

My biggest problem is that Clang (pretty much used by all language servers like clangd and ccls) chokes on a lot of the NDK includes (mainly protos and any declarations using 68k registers. Basically means auto-complete etc. doesn't work, or partially works.
Which version/release of the AmigaOS 3.2 NDK are you currently using, exactly? The most recent release is still AmigaDOS 3.2 NDK R4, with R5 still being in the works.

R5 features further interface header file changes which render them more robust if the compiler environment claims to be the GNU 'C' compiler, but is really clang. The interface header files assumed that if gcc was showing its hand, it was a native or cross compiler targeted for AmigaOS 68k. With the current work-in-progress, you can actually use these header files directly with VSCode, for example, and no local changes required to even narrowly avoid tripping the code completion up. One of these days we might even had helpful code comments in the <clib/#?_protos.h> header files

R4 was still focused on getting the gcc 68k and vbcc interface header files into shape. That there was more trouble on the horizon with cross-compilation, etc. had yet to be discovered and addressed
Olaf Barthel is offline  
Old 06 March 2024, 13:07   #1542
Mafi
Registered User
 
Join Date: Jul 2022
Location: Australia
Posts: 49
Quote:
Originally Posted by Olaf Barthel View Post
Which version/release of the AmigaOS 3.2 NDK are you currently using, exactly? The most recent release is still AmigaDOS 3.2 NDK R4, with R5 still being in the works.

R5 features further interface header file changes which render them more robust if the compiler environment claims to be the GNU 'C' compiler, but is really clang. The interface header files assumed that if gcc was showing its hand, it was a native or cross compiler targeted for AmigaOS 68k. With the current work-in-progress, you can actually use these header files directly with VSCode, for example, and no local changes required to even narrowly avoid tripping the code completion up. One of these days we might even had helpful code comments in the <clib/#?_protos.h> header files

R4 was still focused on getting the gcc 68k and vbcc interface header files into shape. That there was more trouble on the horizon with cross-compilation, etc. had yet to be discovered and addressed
TBH, I'm not sure... at least as it relates to the cross-compilation toolchain. I run Bebbo's install and it downloads NDK automatically; I just checked the header files and they appear to be dated mid-2021?!). On my real-Amiga I use R4.

Now I'm eagerly awaiting R5! My goal is to use (neo)vim with something like YCM as the auto-completion plugin. If I can get that going with 3.2 NDK R5 I'll be super happy.

Thanks for the update.

-M
Mafi is offline  
Old 06 March 2024, 13:36   #1543
thyslo
Registered User
 
Join Date: Apr 2018
Location: Germany
Posts: 189
Thanks for showing the CMakeLists file, I'll have a look at it.

For autocomplete when programming in VSCode I have a workaround. In vscode setting file c_cpp_properties.json I define __clang__

Code:
            "defines": [
                "__clang__"
            ],
And in the .c/.cpp files I include the library proto headers like:
Code:
#ifdef __clang__
  #include <clib/alib_protos.h>
  #include <clib/exec_protos.h>
  #include <clib/dos_protos.h>
  #include <clib/intuition_protos.h>
#else
  #include <proto/alib.h>
  #include <proto/dos.h>
  #include <proto/exec.h>
  #include <proto/intuition.h>
#endif
With this, autocomplete works quite well here.
thyslo is offline  
Old 06 March 2024, 14:06   #1544
Olaf Barthel
Registered User
 
Join Date: Aug 2010
Location: Germany
Posts: 532
Quote:
Originally Posted by Mafi View Post
TBH, I'm not sure... at least as it relates to the cross-compilation toolchain. I run Bebbo's install and it downloads NDK automatically; I just checked the header files and they appear to be dated mid-2021?!).
That likely makes them part of AmigaOS NDK 3.2 R3. The R4 header files should be dated early February 2022 (and we didn't manage to release R5 in 2023).

Quote:
On my real-Amiga I use R4.


Quote:
Now I'm eagerly awaiting R5! My goal is to use (neo)vim with something like YCM as the auto-completion plugin. If I can get that going with 3.2 NDK R5 I'll be super happy.

Thanks for the update.

-M
Happy to whet your appetite It's been taking longer than expected to get the next release "into orbit" because of the bug fixes applied to header files and much expanded documentation for the dos.library in the form of the now largest Autodoc file ever. Questions will be answered which managed to elude explanation and context for more than 30 years.

Just this month we kindly received fixes for the assembly language header files found in the "datatypes" drawer: they had been broken since at least 1993. The dos.library 'C' header files have been thoroughly reworked for perhaps the first time since 1989.

There's plenty to look forward to and, hopefully, make it easier to unlock what was previously hard to find in the documentation, if at all.
Olaf Barthel is offline  
Old 07 March 2024, 05:14   #1545
Mafi
Registered User
 
Join Date: Jul 2022
Location: Australia
Posts: 49
Thanks Thyslo! I think there are other non-proto files that use __stdargs and ASM registers that clang refuses to work with. However, this might be a good stop-gap to eliminate a good chunk of errors!

-M
Mafi is offline  
Old 07 March 2024, 12:16   #1546
Mafi
Registered User
 
Join Date: Jul 2022
Location: Australia
Posts: 49
Ok, I replaced the NDK version installed as part of the toolchain with R4 and clang complains much less, like much less. So for now I can probably live with this until R5 is made available! Thanks again.

-M
Mafi is offline  
Old 07 March 2024, 17:33   #1547
Olaf Barthel
Registered User
 
Join Date: Aug 2010
Location: Germany
Posts: 532
Quote:
Originally Posted by Mafi View Post
Ok, I replaced the NDK version installed as part of the toolchain with R4 and clang complains much less, like much less. So for now I can probably live with this until R5 is made available! Thanks again.

-M
Hey, progress after all

Maybe there is a future for the NDK 3.2 R4 header files in the gcc distribution after all.
Olaf Barthel is offline  
Old 07 March 2024, 21:03   #1548
alkis
Registered User
 
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
Quote:
Originally Posted by Mafi View Post
Ok, I replaced the NDK version installed as part of the toolchain with R4 and clang complains much less, like much less. So for now I can probably live with this until R5 is made available! Thanks again.

-M
For emacs + eglot I had to do it like that
Code:
#ifdef __clang__
#define __stdargs
#define __aligned
#include <clib/dos_protos.h>
#include <clib/exec_protos.h>
#else
#include <proto/dos.h>
#include <proto/exec.h>
#endif
With those two defines I think I stopped getting errors.
alkis is offline  
Old 08 March 2024, 09:33   #1549
Olaf Barthel
Registered User
 
Join Date: Aug 2010
Location: Germany
Posts: 532
Quote:
Originally Posted by alkis View Post
For emacs + eglot I had to do it like that
Code:
#ifdef __clang__
#define __stdargs
#define __aligned
#include <clib/dos_protos.h>
#include <clib/exec_protos.h>
#else
#include <proto/dos.h>
#include <proto/exec.h>
#endif
With those two defines I think I stopped getting errors.
Careful about that __aligned keyword. The code which needs it may have to be rewritten. Accidentally removing it through the preprocessor can have unforseen and really annoying consequences. The stack may get trashed, which is always hard to detect as the cause of unexpected trouble.
Olaf Barthel is offline  
Old 08 March 2024, 10:48   #1550
alkis
Registered User
 
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
Quote:
Originally Posted by Olaf Barthel View Post
Careful about that __aligned keyword. The code which needs it may have to be rewritten. Accidentally removing it through the preprocessor can have unforseen and really annoying consequences. The stack may get trashed, which is always hard to detect as the cause of unexpected trouble.
No. See this is only for __clang__ (which emacs' eglot uses). When you do the actual compile with gcc, __clang__ is not defined.
alkis is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
New GCC based dev toolchain for AmigaOS 3.x cla Coders. Releases 8 24 December 2017 10:18
Issue with photon/xxxx WinUAE Toolchain arpz Coders. Asm / Hardware 2 26 September 2015 22:33
New 68k gcc toolchain arti Coders. C/C++ 17 31 July 2015 03:59
Hannibal's WinUAE Demo Toolchain 5 Bobic Amiga scene 1 23 July 2015 21:04
From gcc to vbcc. Cowcat Coders. General 9 06 June 2014 14:45

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:54.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.20911 seconds with 15 queries