From 7dcc9226b0f3d7c3b54a404efcc8abbabd7a6824 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B6rn=20Svensson?= Date: Thu, 29 Aug 2024 21:14:02 +0200 Subject: [PATCH 1/2] __DATE__ should have day prefixed with space MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The documentation for GCC, and other compilers, stipulates that __DATE__ with a day of month less than 10 should be prefixed by a space, not a zero. Contributed by STMicroelectronics Signed-off-by: Torbjörn Svensson --- .../eclipse/cdt/internal/core/parser/scanner/DateMacro.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/DateMacro.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/DateMacro.java index 2bf8baa9eaa..2aba20a48c8 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/DateMacro.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/DateMacro.java @@ -36,7 +36,11 @@ private char[] createDate() { DateFormatSymbols dfs = new DateFormatSymbols(); buffer.append(dfs.getShortMonths()[cal.get(Calendar.MONTH)]); buffer.append(" "); //$NON-NLS-1$ - append(buffer, cal.get(Calendar.DAY_OF_MONTH)); + int dom = cal.get(Calendar.DAY_OF_MONTH); + if (dom < 10) { + buffer.append(" "); //$NON-NLS-1$ + } + buffer.append(dom); buffer.append(" "); //$NON-NLS-1$ buffer.append(cal.get(Calendar.YEAR)); buffer.append("\""); //$NON-NLS-1$ From d86ec888148294194720ddfc7ea1196452aa5eb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B6rn=20Svensson?= Date: Fri, 30 Aug 2024 12:00:25 +0200 Subject: [PATCH 2/2] __DATE__ should expand with the name of the month in English MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Contributed by STMicroelectronics Signed-off-by: Torbjörn Svensson --- .../eclipse/cdt/internal/core/parser/scanner/DateMacro.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/DateMacro.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/DateMacro.java index 2aba20a48c8..df35967df52 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/DateMacro.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/DateMacro.java @@ -16,6 +16,7 @@ import java.text.DateFormatSymbols; import java.util.Calendar; +import java.util.Locale; import org.eclipse.cdt.core.parser.IToken; @@ -33,7 +34,7 @@ private char[] createDate() { char[] charArray; StringBuilder buffer = new StringBuilder("\""); //$NON-NLS-1$ Calendar cal = Calendar.getInstance(); - DateFormatSymbols dfs = new DateFormatSymbols(); + DateFormatSymbols dfs = new DateFormatSymbols(Locale.ENGLISH); buffer.append(dfs.getShortMonths()[cal.get(Calendar.MONTH)]); buffer.append(" "); //$NON-NLS-1$ int dom = cal.get(Calendar.DAY_OF_MONTH);