cancel
Showing results for 
Search instead for 
Did you mean: 

__DATE__ macro expansion incorrect in editor

Gcc and Visual Studio correctly compile today's date __DATE__ to "May  6 2024". However STM32CubeIDE editor expands the macro incorrectly if I hover the cursor over it.

  • Month name is in Dutch
  • Month name is in lower case
  • Day of month is left-padded with 0 instead of a space

Schermafbeelding 2024-05-06 135149.png

 

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.
17 REPLIES 17
SofLit
ST Employee

Hello,

I didn't reproduce the issue with CubeIDE 1.15.1 (today May 7th 2024):

SofLit_0-1715100169632.png

If you could share your sample project so I can reproduce it from my side. Also indicate the CubeIDE version you're using.

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
PS: This is NOT an online support (https://ols.st.com) but a collaborative space. So please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help/support.

I use STM32CubeIDE 1.11.2 at the moment. My system language is Dutch. I can check if the same problem persists with a newer version.
You did manage to reproduce part of the issue. The day of the month should not be left-padded with a zero, but with a space. If you compile GCC uses the proper format. It's only the preview in the editor that is incorrect.

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.

Hello,

This is what I get with CubeIDE 1.15.1:

SofLit_1-1715159673670.png

Day of month is left padded with a space.

Ok then it's only the display popup is different but the string contains the correct char: a space. Do you see an issue in that behavior?

 

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
PS: This is NOT an online support (https://ols.st.com) but a collaborative space. So please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help/support.

Issues are only in macro expansion in editor (popup as you call it), not in binary.

I tested with a freshly generated project and an old project and in version 1.15.1 as well. Issue is not project specific.
In STM32CubeIDE 1.15.1 I get the same result as you. So only the left-padding issue, not the language or capitalization. And in 1.11.2 and 1.10.1 I see all three issues. So it seems the issue got half-fixed at some point.

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.

Ok.

I'm not seeing a blocking issue in that since it's only a display and doesn't impact the cross-compilation result meanwhile I'm raising the internal ticket 180951 to fix this minor issue. This ticket is not accessible by community members.

I will get back to you for any feedback: to fix or not to fix.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
PS: This is NOT an online support (https://ols.st.com) but a collaborative space. So please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help/support.

Problem with zero-padding still present in STM32CubeIDE V1.17.0.
Tested in windows sandbox to allow changing of system date (my work PC doesn't allow me to change system date).

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.

Hello @unsigned_char_array 

I will keep you updated when it is fixed.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
PS: This is NOT an online support (https://ols.st.com) but a collaborative space. So please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help/support.

Strikes me as a intrinsic MACRO furnished by STM32CudeIDE based on the date stamp of the file, rather than something GCC or VS is responsible for at this point.

The criticality of this is probably deemed quite low as it's more of a syntax-check / visual cue rather than something that materially impacts the code build. You have some compile time dependency on this?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

The __DATE__ macro is specified by the C language standard:

https://en.cppreference.com/w/cpp/preprocessor/replace#:~:text=expands%20to%20the%20date,is%20less%20than%2010

CubeIDE is not abiding by that standard.

 

A very minor point, IMO - but it is wrong.