Skip to content

Fix compilation of 45ESR with GCC 5.50 #278

@dryeo

Description

@dryeo

Paul backported some SSE fixes to GCC 5.5.0. Attempting to compile results in one build break, snippet, this is repeated for other values.

C:/work/cc45esr/mozilla/toolkit/components/osfile/NativeOSFileInternals.cpp:161:5: error: 'EINVAL' was not declared in this scope"}]
[1544037380.742, "build_output", {"line": "     EINVAL, EINVAL, ENOENT, ENOENT, EMFILE,  /* 0..4 */"}]
[1544037380.742, "build_output", {"line": "     ^"}]
[1544037380.742, "build_output", {"line": "C:/work/cc45esr/mozilla/toolkit/components/osfile/NativeOSFileInternals.cpp:161:21: error: 'ENOENT' was not declared in this scope"}]
[1544037380.755, "build_output", {"line": "     EINVAL, EINVAL, ENOENT, ENOENT, EMFILE,  /* 0..4 */"}]
[1544037380.757, "build_output", {"line": "                     ^"}]

and a bunch of output about redefined macros, snippet,

 "In file included from <command-line>:0:0:"}]
[1544037381.96, "build_output", {"line": "./../../mozilla-config.h:153:0: warning: \"__STDC_LIMIT_MACROS\" redefined"}]
[1544037381.96, "build_output", {"line": " #define __STDC_LIMIT_MACROS"}]
[1544037381.962, "build_output", {"line": " ^"}]
[1544037381.962, "build_output", {"line": "<built-in>: note: this is the location of the previous definition"}]
[1544037381.962, "build_output", {"line": "In file included from <command-line>:0:0:"}]
[1544037381.962, "build_output", {"line": "./../../mozilla-config.h:154:0: warning: \"__STDC_CONSTANT_MACROS\" redefined"}]
[1544037382.332, "build_output", {"line": " #define __STDC_CONSTANT_MACROS"}]
[1544037382.332, "build_output", {"line": " ^"}]
[1544037382.332, "build_output", {"line": "<built-in>: note: this is the location of the previous definition"}]

I'll inline the 2 needed patches, be nice to get them applied.

From e8bdcad2dbae7d11e13c2a0b14d9566977eaf337 Mon Sep 17 00:00:00 2001
From: Dave Yeo <dave.r.yeo@gmail.com>
Date: Mon, 26 Nov 2018 14:54:58 -0800
Subject: [PATCH 1/2] Add some guards to make newer versions of GCC happy

Signed-off-by: Dave Yeo <dave.r.yeo@gmail.com>
---
 js/public/RequiredDefines.h | 6 ++++++
 mozilla-config.h.in         | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/js/public/RequiredDefines.h b/js/public/RequiredDefines.h
index 308fd7d625..242755e99b 100644
--- a/js/public/RequiredDefines.h
+++ b/js/public/RequiredDefines.h
@@ -24,9 +24,15 @@
  * and with __STDC_FORMAT_MACROS for the format macros (PRId32 for example) used
  * with the fprintf function family.
  */
+#if !defined (__STDC_LIMIT_MACROS)
 #define __STDC_LIMIT_MACROS
+#endif
+#if !defined (__STDC_CONSTANT_MACROS)
 #define __STDC_CONSTANT_MACROS
+#endif
+#if !defined(__STDC_FORMAT_MACROS)
 #define __STDC_FORMAT_MACROS
+#endif
 
 /* Also define a char16_t type if not provided by the compiler. */
 #include "mozilla/Char16.h"
diff --git a/mozilla-config.h.in b/mozilla-config.h.in
index 8d2c857a65..dc089b79a9 100644
--- a/mozilla-config.h.in
+++ b/mozilla-config.h.in
@@ -26,8 +26,12 @@
  * and with __STDC_FORMAT_MACROS for the format macros (PRId32 for example) used
  * with the fprintf function family.
  */
+#if !defined (__STDC_LIMIT_MACROS)
 #define __STDC_LIMIT_MACROS
+#endif
+#if !defined (__STDC_CONSTANT_MACROS)
 #define __STDC_CONSTANT_MACROS
+#endif
 #if !defined(__STDC_FORMAT_MACROS)
 #define __STDC_FORMAT_MACROS
 #endif
-- 
2.11.0
From aa926ab36eefc07a7b8a54dcf1bce69c240f343b Mon Sep 17 00:00:00 2001
From: Dave Yeo <dave.r.yeo@gmail.com>
Date: Wed, 5 Dec 2018 19:44:28 -0800
Subject: [PATCH 2/2] [OS/2]Add an include to make GCC 5.5.0 happy

Fixes a bunch of errors where things like EINVAL was not declared in this scope

Signed-off-by: Dave Yeo <dave.r.yeo@gmail.com>
---
 toolkit/components/osfile/NativeOSFileInternals.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/toolkit/components/osfile/NativeOSFileInternals.cpp b/toolkit/components/osfile/NativeOSFileInternals.cpp
index cbb58666aa..e555d467ae 100644
--- a/toolkit/components/osfile/NativeOSFileInternals.cpp
+++ b/toolkit/components/osfile/NativeOSFileInternals.cpp
@@ -49,6 +49,10 @@
 #include <windows.h>
 #endif // defined (XP_WIN)
 
+#if defined(XP_OS2)
+#include <errno.h>
+#endif
+
 namespace mozilla {
 
 MOZ_TYPE_SPECIFIC_SCOPED_POINTER_TEMPLATE(ScopedPRFileDesc, PRFileDesc, PR_Close)
-- 
2.11.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions