From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Use of GNU statement expression extension

Solved!
Go to solution

Hello, hello,

I'd like to rewrite some of my old side-effect macros in a more modern (C99/C11) way using compound statements, such as this:

#define MIN(x,y)    ({ __auto_type __x = (x); __auto_type __y = (y); __x < __y ? __x : __y; })

It compiles fine with gcc, but Clang used by CVI gives me the error mentioned in the title. Apparently, all I need to do is to add -Wno-gnu, but I don't see where I can add compiler-specific options.

I also tried #pragma clang diagnostic ignored "-Wno-gnu" without success

0 Kudos
Message 1 of 14
(6,076 Views)
Solution
Accepted by topic author gdargaud

Hi gdargaud,

 

The CVI compiler doesn't support GNU statement expressions. This is currently documented in this KB document.

Here's an alternative for your use case: https://gcc.gnu.org/onlinedocs/cpp/Duplication-of-Side-Effects.html

 

Best regards,

- Johannes

0 Kudos
Message 2 of 14
(6,068 Views)

OK, thanks.

I'm just surprised that several features which were supported in CVI2013 are no longer supported in 2015. Is that when CVI started using CLANG instead of the old NI compiler ? (I thought it was earlier than that). Why isn't the full power of CLANG available ?

0 Kudos
Message 3 of 14
(6,064 Views)

While I'm at it, there are several other things from C99 that seem to be missing from CVI, in particular all the newer math functions, such as hypot, fma, lrint, etc... Or do I have to include some extra file to get them ? Just enabling the C99 option is not enough.

 

And what about C11 (for type generic macros in particular) ? It's been over 5 years now ! And Clang mostly supports it.

0 Kudos
Message 4 of 14
(5,956 Views)

Hi gdargaud,

The CVI compiler has been replaced with a Clang-based implementation starting with CVI 2013, responding to the need to provide a robust and modern toolchain that CVI customers can use to develop their applications. Still, from an investment standpoint or compatibility reasons, some features are not yet supported.

 

Which are the several features that you are refering to, which were supported in CVI 2013, but not anymore in CVI 2015?

 

Thanks,

- Johannes

0 Kudos
Message 5 of 14
(5,949 Views)

Well, directly from the table you provided, there used to be support for complex numbers, compound litterals and binary const.

0 Kudos
Message 6 of 14
(5,937 Views)
Solution
Accepted by topic author gdargaud

Hi gdargaud,

Fortunately, support for Complex numbers, compound literals and binary constants has been fixed in the CVI 2015 SP1 release. Please look for CARs 541058, 540675, and 539474 in the LabWindows™/CVI™ 2015 SP1 Bug Fix Information document.

 

Best regards,

- Johannes

0 Kudos
Message 7 of 14
(5,932 Views)

Hi @Johannes_T,

the link to KB document is broken.

Can you fix, please?

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 8 of 14
(3,473 Views)

Hi vix -

 

To recall, the KB under discussion is "What C Extensions Does LabWindows™/CVI™ 2013 and 2015 Support?"

I have reported the issue, for the broken link to get fixed as soon as possible.

 

If you see other problems with the ni.com website, you can use the "Site Feedback" button, located at the footer of every ni.com page, to report an issue.

 

In the meantime here are several alternatives:

  1. You can refer to the "C Language Extensions" help topic in the CVI help.
  2. You can refer to a third-party alternative to see a frozen snapshot of the page. Here's one that I have found: https://web.archive.org/web/20160814143008/http://digital.ni.com/public.nsf/allkb/73AEAD30C8AF681A86...

 

I hope this was useful.

 

Best regards,

- Johannes

0 Kudos
Message 9 of 14
(3,463 Views)

@Johannes_T  wrote:

 

If you see other problems with the ni.com website, you can use the "Site Feedback" button, located at the footer of every ni.com page, to report an issue.

I can't see that button...

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 10 of 14
(3,438 Views)