summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/page/cpdf_allstates.cpp8
-rw-r--r--core/fpdfapi/parser/cpdf_data_avail.cpp4
-rw-r--r--core/fpdfapi/render/cpdf_dibtransferfunc.cpp4
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp2
-rw-r--r--core/fpdfdoc/cpdf_variabletext.cpp4
-rw-r--r--core/fxcodec/codec/ccodec_pngmodule.cpp4
-rw-r--r--core/fxcrt/css/cfx_csssyntaxparser.cpp12
-rw-r--r--core/fxcrt/fx_extension.cpp4
-rw-r--r--core/fxcrt/fx_fallthrough.h20
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_context.cpp4
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_page.cpp8
-rw-r--r--fpdfsdk/pwl/cpwl_edit_impl.cpp4
-rw-r--r--fxjs/xfa/cjx_object.cpp4
-rw-r--r--testing/image_diff/image_diff_png.cpp4
-rw-r--r--third_party/base/compiler_specific.h56
-rw-r--r--xfa/fxfa/parser/cxfa_document.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp16
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp4
18 files changed, 72 insertions, 94 deletions
diff --git a/core/fpdfapi/page/cpdf_allstates.cpp b/core/fpdfapi/page/cpdf_allstates.cpp
index d2491bbee7..9af904cb5d 100644
--- a/core/fpdfapi/page/cpdf_allstates.cpp
+++ b/core/fpdfapi/page/cpdf_allstates.cpp
@@ -12,8 +12,8 @@
#include "core/fpdfapi/page/cpdf_streamcontentparser.h"
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
-#include "core/fxcrt/fx_fallthrough.h"
#include "core/fxge/cfx_graphstatedata.h"
+#include "third_party/base/compiler_specific.h"
#include "third_party/base/stl_util.h"
CPDF_AllStates::CPDF_AllStates()
@@ -90,7 +90,7 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS,
if (pGS->KeyExist("TR2")) {
continue;
}
- FX_FALLTHROUGH;
+ FALLTHROUGH;
case FXBSTR_ID('T', 'R', '2', 0):
m_GeneralState.SetTR(pObject && !pObject->IsName() ? pObject : nullptr);
break;
@@ -133,7 +133,7 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS,
if (pGS->KeyExist("BG2")) {
continue;
}
- FX_FALLTHROUGH;
+ FALLTHROUGH;
case FXBSTR_ID('B', 'G', '2', 0):
m_GeneralState.SetBG(pObject);
break;
@@ -141,7 +141,7 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS,
if (pGS->KeyExist("UCR2")) {
continue;
}
- FX_FALLTHROUGH;
+ FALLTHROUGH;
case FXBSTR_ID('U', 'C', 'R', '2'):
m_GeneralState.SetUCR(pObject);
break;
diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp
index 3ffe6f6f0b..1296b2320b 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.cpp
+++ b/core/fpdfapi/parser/cpdf_data_avail.cpp
@@ -26,8 +26,8 @@
#include "core/fpdfapi/parser/fpdf_parser_utility.h"
#include "core/fxcrt/cfx_memorystream.h"
#include "core/fxcrt/fx_extension.h"
-#include "core/fxcrt/fx_fallthrough.h"
#include "core/fxcrt/fx_safe_types.h"
+#include "third_party/base/compiler_specific.h"
#include "third_party/base/numerics/safe_conversions.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
@@ -134,7 +134,7 @@ bool CPDF_DataAvail::CheckDocStatus() {
return LoadAllFile();
case PDF_DATAAVAIL_PAGE_LATERLOAD:
m_docStatus = PDF_DATAAVAIL_PAGE;
- FX_FALLTHROUGH;
+ FALLTHROUGH;
default:
m_bDocAvail = true;
return true;
diff --git a/core/fpdfapi/render/cpdf_dibtransferfunc.cpp b/core/fpdfapi/render/cpdf_dibtransferfunc.cpp
index 959fec383d..b73fc77ce9 100644
--- a/core/fpdfapi/render/cpdf_dibtransferfunc.cpp
+++ b/core/fpdfapi/render/cpdf_dibtransferfunc.cpp
@@ -10,7 +10,7 @@
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/render/cpdf_transferfunc.h"
-#include "core/fxcrt/fx_fallthrough.h"
+#include "third_party/base/compiler_specific.h"
CPDF_DIBTransferFunc::CPDF_DIBTransferFunc(
const RetainPtr<CPDF_TransferFunc>& pTransferFunc)
@@ -120,7 +120,7 @@ void CPDF_DIBTransferFunc::TranslateScanline(
}
case FXDIB_Rgb32:
bSkip = true;
- FX_FALLTHROUGH;
+ FALLTHROUGH;
case FXDIB_Argb: {
int index = 0;
for (int i = 0; i < m_Width; i++) {
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index f33b304b63..89cddbaa25 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -49,7 +49,6 @@
#include "core/fpdfapi/render/cpdf_type3cache.h"
#include "core/fpdfdoc/cpdf_occontext.h"
#include "core/fxcrt/autorestorer.h"
-#include "core/fxcrt/fx_fallthrough.h"
#include "core/fxcrt/fx_safe_types.h"
#include "core/fxcrt/maybe_owned.h"
#include "core/fxge/cfx_defaultrenderdevice.h"
@@ -57,6 +56,7 @@
#include "core/fxge/cfx_pathdata.h"
#include "core/fxge/cfx_renderdevice.h"
#include "core/fxge/renderdevicedriver_iface.h"
+#include "third_party/base/compiler_specific.h"
#include "third_party/base/logging.h"
#include "third_party/base/numerics/safe_math.h"
#include "third_party/base/ptr_util.h"
diff --git a/core/fpdfdoc/cpdf_variabletext.cpp b/core/fpdfdoc/cpdf_variabletext.cpp
index 7da1b2f946..31f09c9dcd 100644
--- a/core/fpdfdoc/cpdf_variabletext.cpp
+++ b/core/fpdfdoc/cpdf_variabletext.cpp
@@ -16,7 +16,7 @@
#include "core/fpdfdoc/csection.h"
#include "core/fpdfdoc/ipvt_fontmap.h"
#include "core/fxcrt/fx_codepage.h"
-#include "core/fxcrt/fx_fallthrough.h"
+#include "third_party/base/compiler_specific.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
@@ -318,7 +318,7 @@ void CPDF_VariableText::SetText(const WideString& swText) {
break;
case 0x09:
word = 0x20;
- FX_FALLTHROUGH;
+ FALLTHROUGH;
default:
wp = InsertWord(wp, word, FX_CHARSET_Default);
break;
diff --git a/core/fxcodec/codec/ccodec_pngmodule.cpp b/core/fxcodec/codec/ccodec_pngmodule.cpp
index 7aedf2ee7f..98db4e272e 100644
--- a/core/fxcodec/codec/ccodec_pngmodule.cpp
+++ b/core/fxcodec/codec/ccodec_pngmodule.cpp
@@ -10,9 +10,9 @@
#include "core/fxcodec/codec/codec_int.h"
#include "core/fxcodec/fx_codec.h"
-#include "core/fxcrt/fx_fallthrough.h"
#include "core/fxcrt/unowned_ptr.h"
#include "core/fxge/fx_dib.h"
+#include "third_party/base/compiler_specific.h"
#include "third_party/base/ptr_util.h"
#ifdef USE_SYSTEM_LIBPNG
@@ -139,7 +139,7 @@ static void _png_get_header_func(png_structp png_ptr, png_infop info_ptr) {
if (color_type1 != PNG_COLOR_TYPE_PALETTE) {
png_error(pContext->m_pPng, "Not Support Output Palette Now");
}
- FX_FALLTHROUGH;
+ FALLTHROUGH;
case PNG_COLOR_TYPE_RGB:
case PNG_COLOR_TYPE_RGB_ALPHA:
if (!(color_type1 & PNG_COLOR_MASK_COLOR)) {
diff --git a/core/fxcrt/css/cfx_csssyntaxparser.cpp b/core/fxcrt/css/cfx_csssyntaxparser.cpp
index 97586dc59f..844337c1ca 100644
--- a/core/fxcrt/css/cfx_csssyntaxparser.cpp
+++ b/core/fxcrt/css/cfx_csssyntaxparser.cpp
@@ -12,7 +12,7 @@
#include "core/fxcrt/css/cfx_cssdeclaration.h"
#include "core/fxcrt/fx_codepage.h"
#include "core/fxcrt/fx_extension.h"
-#include "core/fxcrt/fx_fallthrough.h"
+#include "third_party/base/compiler_specific.h"
#include "third_party/base/logging.h"
namespace {
@@ -75,7 +75,7 @@ CFX_CSSSyntaxStatus CFX_CSSSyntaxParser::DoSyntaxParse() {
SwitchMode(CFX_CSSSyntaxMode::Comment);
break;
}
- FX_FALLTHROUGH;
+ FALLTHROUGH;
default:
if (wch <= ' ') {
m_TextPlane.MoveNext();
@@ -112,7 +112,7 @@ CFX_CSSSyntaxStatus CFX_CSSSyntaxParser::DoSyntaxParse() {
return CFX_CSSSyntaxStatus::Selector;
break;
}
- FX_FALLTHROUGH;
+ FALLTHROUGH;
default:
AppendChar(wch);
break;
@@ -137,7 +137,7 @@ CFX_CSSSyntaxStatus CFX_CSSSyntaxParser::DoSyntaxParse() {
return CFX_CSSSyntaxStatus::PropertyName;
break;
}
- FX_FALLTHROUGH;
+ FALLTHROUGH;
default:
AppendChar(wch);
break;
@@ -147,7 +147,7 @@ CFX_CSSSyntaxStatus CFX_CSSSyntaxParser::DoSyntaxParse() {
switch (wch) {
case ';':
m_TextPlane.MoveNext();
- FX_FALLTHROUGH;
+ FALLTHROUGH;
case '}':
SwitchMode(CFX_CSSSyntaxMode::PropertyName);
return CFX_CSSSyntaxStatus::PropertyValue;
@@ -157,7 +157,7 @@ CFX_CSSSyntaxStatus CFX_CSSSyntaxParser::DoSyntaxParse() {
return CFX_CSSSyntaxStatus::PropertyValue;
break;
}
- FX_FALLTHROUGH;
+ FALLTHROUGH;
default:
AppendChar(wch);
break;
diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp
index a27e0279c6..e27c78d7bf 100644
--- a/core/fxcrt/fx_extension.cpp
+++ b/core/fxcrt/fx_extension.cpp
@@ -10,7 +10,7 @@
#include <cwctype>
#include <limits>
-#include "core/fxcrt/fx_fallthrough.h"
+#include "third_party/base/compiler_specific.h"
float FXSYS_wcstof(const wchar_t* pwsStr, int32_t iLength, int32_t* pUsedLen) {
ASSERT(pwsStr);
@@ -25,7 +25,7 @@ float FXSYS_wcstof(const wchar_t* pwsStr, int32_t iLength, int32_t* pUsedLen) {
switch (pwsStr[iUsedLen]) {
case '-':
bNegtive = true;
- FX_FALLTHROUGH;
+ FALLTHROUGH;
case '+':
iUsedLen++;
break;
diff --git a/core/fxcrt/fx_fallthrough.h b/core/fxcrt/fx_fallthrough.h
deleted file mode 100644
index 5587ee2295..0000000000
--- a/core/fxcrt/fx_fallthrough.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2018 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CORE_FXCRT_FX_FALLTHROUGH_H_
-#define CORE_FXCRT_FX_FALLTHROUGH_H_
-
-// When clang suggests inserting [[clang::fallthrough]], it first checks if
-// it knows of a macro expanding to it, and if so suggests inserting the
-// macro. This means that this macro must be used only in code internal
-// to PDFium, so that PDFium's user code doesn't end up getting suggestions
-// for FX_FALLTHROUGH instead of the user-specific fallthrough macro.
-// So do not include this header in any of PDFium's public headers.
-#if defined(__clang__)
-#define FX_FALLTHROUGH [[clang::fallthrough]]
-#else
-#define FX_FALLTHROUGH
-#endif
-
-#endif // CORE_FXCRT_FX_FALLTHROUGH_H_
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
index 05bb56ca99..ed58d24b1f 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
@@ -10,7 +10,6 @@
#include <utility>
#include "core/fpdfapi/parser/cpdf_document.h"
-#include "core/fxcrt/fx_fallthrough.h"
#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
#include "fpdfsdk/cpdfsdk_helpers.h"
#include "fpdfsdk/cpdfsdk_interform.h"
@@ -20,6 +19,7 @@
#include "fxjs/cjs_runtime.h"
#include "fxjs/ijs_runtime.h"
#include "public/fpdf_formfill.h"
+#include "third_party/base/compiler_specific.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fgas/font/cfgas_defaultfontmanager.h"
@@ -131,7 +131,7 @@ int CPDFXFA_Context::GetPageCount() const {
case FormType::kXFAForeground:
if (m_pPDFDoc)
return m_pPDFDoc->GetPageCount();
- FX_FALLTHROUGH;
+ FALLTHROUGH;
case FormType::kXFAFull:
if (m_pXFADoc)
return m_pXFADocView->CountPageViews();
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
index da1c1e521a..170f17ea7a 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
@@ -8,11 +8,11 @@
#include "core/fpdfapi/page/cpdf_page.h"
#include "core/fpdfapi/parser/cpdf_document.h"
-#include "core/fxcrt/fx_fallthrough.h"
#include "fpdfsdk/cpdfsdk_helpers.h"
#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#include "fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h"
#include "public/fpdf_formfill.h"
+#include "third_party/base/compiler_specific.h"
#include "third_party/base/ptr_util.h"
#include "xfa/fxfa/cxfa_ffdocview.h"
#include "xfa/fxfa/cxfa_ffpageview.h"
@@ -100,7 +100,7 @@ float CPDFXFA_Page::GetPageWidth() const {
case FormType::kXFAForeground:
if (m_pPDFPage)
return m_pPDFPage->GetPageWidth();
- FX_FALLTHROUGH;
+ FALLTHROUGH;
case FormType::kXFAFull:
if (m_pXFAPageView)
return m_pXFAPageView->GetPageViewRect().width;
@@ -120,7 +120,7 @@ float CPDFXFA_Page::GetPageHeight() const {
case FormType::kXFAForeground:
if (m_pPDFPage)
return m_pPDFPage->GetPageHeight();
- FX_FALLTHROUGH;
+ FALLTHROUGH;
case FormType::kXFAFull:
if (m_pXFAPageView)
return m_pXFAPageView->GetPageViewRect().height;
@@ -164,7 +164,7 @@ CFX_Matrix CPDFXFA_Page::GetDisplayMatrix(const FX_RECT& rect,
case FormType::kXFAForeground:
if (m_pPDFPage)
return m_pPDFPage->GetDisplayMatrix(rect, iRotate);
- FX_FALLTHROUGH;
+ FALLTHROUGH;
case FormType::kXFAFull:
if (m_pXFAPageView)
return m_pXFAPageView->GetDisplayMatrix(rect, iRotate);
diff --git a/fpdfsdk/pwl/cpwl_edit_impl.cpp b/fpdfsdk/pwl/cpwl_edit_impl.cpp
index 6d9fd20445..70b483bd14 100644
--- a/fpdfsdk/pwl/cpwl_edit_impl.cpp
+++ b/fpdfsdk/pwl/cpwl_edit_impl.cpp
@@ -23,7 +23,6 @@
#include "core/fpdfdoc/ipvt_fontmap.h"
#include "core/fxcrt/autorestorer.h"
#include "core/fxcrt/fx_codepage.h"
-#include "core/fxcrt/fx_fallthrough.h"
#include "core/fxge/cfx_graphstatedata.h"
#include "core/fxge/cfx_pathdata.h"
#include "core/fxge/cfx_renderdevice.h"
@@ -31,6 +30,7 @@
#include "fpdfsdk/pwl/cpwl_edit.h"
#include "fpdfsdk/pwl/cpwl_edit_ctrl.h"
#include "fpdfsdk/pwl/cpwl_scroll_bar.h"
+#include "third_party/base/compiler_specific.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
@@ -1818,7 +1818,7 @@ CPVT_WordPlace CPWL_EditImpl::DoInsertText(const CPVT_WordPlace& place,
break;
case '\t':
word = ' ';
- FX_FALLTHROUGH;
+ FALLTHROUGH;
default:
wp =
m_pVT->InsertWord(wp, word, GetCharSetFromUnicode(word, charset));
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp
index 69c6dadddf..ba914221bd 100644
--- a/fxjs/xfa/cjx_object.cpp
+++ b/fxjs/xfa/cjx_object.cpp
@@ -10,7 +10,6 @@
#include "core/fxcrt/cfx_decimal.h"
#include "core/fxcrt/fx_extension.h"
-#include "core/fxcrt/fx_fallthrough.h"
#include "core/fxcrt/xml/cfx_xmltext.h"
#include "fxjs/cfxjse_engine.h"
#include "fxjs/cfxjse_value.h"
@@ -19,6 +18,7 @@
#include "fxjs/xfa/cjx_draw.h"
#include "fxjs/xfa/cjx_field.h"
#include "fxjs/xfa/cjx_instancemanager.h"
+#include "third_party/base/compiler_specific.h"
#include "third_party/base/ptr_util.h"
#include "xfa/fxfa/cxfa_ffnotify.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
@@ -790,7 +790,7 @@ Optional<WideString> CJX_Object::TryContent(bool bScriptModify, bool bProto) {
case XFA_ObjectType::NodeV:
case XFA_ObjectType::TextNode:
pNode = ToNode(GetXFAObject());
- FX_FALLTHROUGH;
+ FALLTHROUGH;
default:
if (ToNode(GetXFAObject())->GetElementType() == XFA_Element::DataValue)
pNode = ToNode(GetXFAObject());
diff --git a/testing/image_diff/image_diff_png.cpp b/testing/image_diff/image_diff_png.cpp
index 47c1fe4c24..89c08f1a0f 100644
--- a/testing/image_diff/image_diff_png.cpp
+++ b/testing/image_diff/image_diff_png.cpp
@@ -16,7 +16,7 @@
#include <string>
-#include "core/fxcrt/fx_fallthrough.h"
+#include "third_party/base/compiler_specific.h"
#include "third_party/base/logging.h"
#include "third_party/zlib/zlib.h"
@@ -582,7 +582,7 @@ bool EncodeWithCompressionLevel(const unsigned char* input,
switch (format) {
case FORMAT_BGR:
converter = ConvertBGRtoRGB;
- FX_FALLTHROUGH;
+ FALLTHROUGH;
case FORMAT_RGB:
input_color_components = 3;
diff --git a/third_party/base/compiler_specific.h b/third_party/base/compiler_specific.h
index 3dbd1abb33..57f7a93e59 100644
--- a/third_party/base/compiler_specific.h
+++ b/third_party/base/compiler_specific.h
@@ -43,22 +43,6 @@
#define MSVC_DISABLE_OPTIMIZE() __pragma(optimize("", off))
#define MSVC_ENABLE_OPTIMIZE() __pragma(optimize("", on))
-// Allows exporting a class that inherits from a non-exported base class.
-// This uses suppress instead of push/pop because the delimiter after the
-// declaration (either "," or "{") has to be placed before the pop macro.
-//
-// Example usage:
-// class EXPORT_API Foo : NON_EXPORTED_BASE(public Bar) {
-//
-// MSVC Compiler warning C4275:
-// non dll-interface class 'Bar' used as base for dll-interface class 'Foo'.
-// Note that this is intended to be used only when no access to the base class'
-// static data is done through derived classes or inline methods. For more info,
-// see http://msdn.microsoft.com/en-us/library/3tdb471s(VS.80).aspx
-#define NON_EXPORTED_BASE(code) \
- MSVC_SUPPRESS_WARNING(4275) \
- code
-
#else // Not MSVC
#define _Printf_format_string_
@@ -68,7 +52,6 @@
#define MSVC_POP_WARNING()
#define MSVC_DISABLE_OPTIMIZE()
#define MSVC_ENABLE_OPTIMIZE()
-#define NON_EXPORTED_BASE(code) code
#endif // COMPILER_MSVC
@@ -78,7 +61,7 @@
// Use like:
// int x = ...;
// ALLOW_UNUSED_LOCAL(x);
-#define ALLOW_UNUSED_LOCAL(x) false ? (void)x : (void)0
+#define ALLOW_UNUSED_LOCAL(x) (void)x
// Annotate a typedef or function indicating it's ok if it's not used.
// Use like:
@@ -112,21 +95,29 @@
// Use like:
// class ALIGNAS(16) MyClass { ... }
// ALIGNAS(16) int array[4];
+//
+// In most places you can use the C++11 keyword "alignas", which is preferred.
+//
+// But compilers have trouble mixing __attribute__((...)) syntax with
+// alignas(...) syntax.
+//
+// Doesn't work in clang or gcc:
+// struct alignas(16) __attribute__((packed)) S { char c; };
+// Works in clang but not gcc:
+// struct __attribute__((packed)) alignas(16) S2 { char c; };
+// Works in clang and gcc:
+// struct alignas(16) S3 { char c; } __attribute__((packed));
+//
+// There are also some attributes that must be specified *before* a class
+// definition: visibility (used for exporting functions/classes) is one of
+// these attributes. This means that it is not possible to use alignas() with a
+// class that is marked as exported.
#if defined(COMPILER_MSVC)
#define ALIGNAS(byte_alignment) __declspec(align(byte_alignment))
#elif defined(COMPILER_GCC)
#define ALIGNAS(byte_alignment) __attribute__((aligned(byte_alignment)))
#endif
-// Return the byte alignment of the given type (available at compile time).
-// Use like:
-// ALIGNOF(int32_t) // this would be 4
-#if defined(COMPILER_MSVC)
-#define ALIGNOF(type) __alignof(type)
-#elif defined(COMPILER_GCC)
-#define ALIGNOF(type) __alignof__(type)
-#endif
-
// Annotate a function indicating the caller must examine the return value.
// Use like:
// int foo() WARN_UNUSED_RESULT;
@@ -207,7 +198,7 @@
// Macro for hinting that an expression is likely to be false.
#if !defined(UNLIKELY)
-#if defined(COMPILER_GCC)
+#if defined(COMPILER_GCC) || defined(__clang__)
#define UNLIKELY(x) __builtin_expect(!!(x), 0)
#else
#define UNLIKELY(x) (x)
@@ -215,7 +206,7 @@
#endif // !defined(UNLIKELY)
#if !defined(LIKELY)
-#if defined(COMPILER_GCC)
+#if defined(COMPILER_GCC) || defined(__clang__)
#define LIKELY(x) __builtin_expect(!!(x), 1)
#else
#define LIKELY(x) (x)
@@ -230,4 +221,11 @@
#define HAS_FEATURE(FEATURE) 0
#endif
+// Macro for telling -Wimplicit-fallthrough that a fallthrough is intentional.
+#if defined(__clang__)
+#define FALLTHROUGH [[clang::fallthrough]]
+#else
+#define FALLTHROUGH
+#endif
+
#endif // BASE_COMPILER_SPECIFIC_H_
diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp
index 15458826ce..4ed337019b 100644
--- a/xfa/fxfa/parser/cxfa_document.cpp
+++ b/xfa/fxfa/parser/cxfa_document.cpp
@@ -10,9 +10,9 @@
#include <utility>
#include "core/fxcrt/fx_extension.h"
-#include "core/fxcrt/fx_fallthrough.h"
#include "core/fxcrt/xml/cfx_xmldocument.h"
#include "fxjs/cfxjse_engine.h"
+#include "third_party/base/compiler_specific.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/cxfa_ffnotify.h"
#include "xfa/fxfa/parser/cscript_datawindow.h"
@@ -445,7 +445,7 @@ CXFA_Node* FindMatchingDataNode(
pResult = pGlobalBindNode;
break;
}
- FX_FALLTHROUGH;
+ FALLTHROUGH;
case XFA_AttributeEnum::Once: {
bAccessedDataDOM = true;
CXFA_Node* pOnceBindNode = FindOnceDataNode(
diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
index 7273adf337..f4f1ceb708 100644
--- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
+++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
@@ -11,8 +11,8 @@
#include <utility>
#include <vector>
-#include "core/fxcrt/fx_fallthrough.h"
#include "fxjs/xfa/cjx_object.h"
+#include "third_party/base/compiler_specific.h"
#include "third_party/base/logging.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
@@ -863,7 +863,7 @@ void CXFA_ItemLayoutProcessor::GotoNextContainerNode(
}
case XFA_ItemLayoutProcessorStages::None: {
pCurActionNode = XFA_LAYOUT_INVALIDNODE;
- FX_FALLTHROUGH;
+ FALLTHROUGH;
case XFA_ItemLayoutProcessorStages::BookendLeader:
for (CXFA_Node* pBookendNode = pCurActionNode == XFA_LAYOUT_INVALIDNODE
? pEntireContainer->GetFirstChild()
@@ -882,7 +882,7 @@ void CXFA_ItemLayoutProcessor::GotoNextContainerNode(
}
{
pCurActionNode = XFA_LAYOUT_INVALIDNODE;
- FX_FALLTHROUGH;
+ FALLTHROUGH;
case XFA_ItemLayoutProcessorStages::BreakBefore:
if (pCurActionNode != XFA_LAYOUT_INVALIDNODE) {
CXFA_Node* pBreakBeforeNode = pCurActionNode->GetNextSibling();
@@ -906,7 +906,7 @@ void CXFA_ItemLayoutProcessor::GotoNextContainerNode(
}
case XFA_ItemLayoutProcessorStages::Container: {
pCurActionNode = XFA_LAYOUT_INVALIDNODE;
- FX_FALLTHROUGH;
+ FALLTHROUGH;
case XFA_ItemLayoutProcessorStages::BreakAfter: {
if (pCurActionNode == XFA_LAYOUT_INVALIDNODE) {
CXFA_Node* pBreakAfterNode = pChildContainer->GetFirstChild();
@@ -961,7 +961,7 @@ void CXFA_ItemLayoutProcessor::GotoNextContainerNode(
NoMoreChildContainer : {
pCurActionNode = XFA_LAYOUT_INVALIDNODE;
- FX_FALLTHROUGH;
+ FALLTHROUGH;
case XFA_ItemLayoutProcessorStages::BookendTrailer:
for (CXFA_Node* pBookendNode = pCurActionNode == XFA_LAYOUT_INVALIDNODE
? pEntireContainer->GetFirstChild()
@@ -978,7 +978,7 @@ void CXFA_ItemLayoutProcessor::GotoNextContainerNode(
}
}
}
- FX_FALLTHROUGH;
+ FALLTHROUGH;
default:
pCurActionNode = nullptr;
*nCurStage = XFA_ItemLayoutProcessorStages::Done;
@@ -1958,10 +1958,10 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
switch (rs) {
case XFA_ItemLayoutProcessorResult::ManualBreak:
bIsManualBreak = true;
- FX_FALLTHROUGH;
+ FALLTHROUGH;
case XFA_ItemLayoutProcessorResult::PageFullBreak:
bForceEndPage = true;
- FX_FALLTHROUGH;
+ FALLTHROUGH;
case XFA_ItemLayoutProcessorResult::RowFullBreak:
goto SuspendAndCreateNewRow;
case XFA_ItemLayoutProcessorResult::Done:
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index a51b74ca63..66c4fb99f4 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -18,7 +18,6 @@
#include "core/fxcrt/cfx_memorystream.h"
#include "core/fxcrt/fx_codepage.h"
#include "core/fxcrt/fx_extension.h"
-#include "core/fxcrt/fx_fallthrough.h"
#include "core/fxcrt/locale_iface.h"
#include "core/fxcrt/xml/cfx_xmlelement.h"
#include "core/fxcrt/xml/cfx_xmlnode.h"
@@ -27,6 +26,7 @@
#include "fxjs/cfxjse_engine.h"
#include "fxjs/cfxjse_value.h"
#include "fxjs/xfa/cjx_node.h"
+#include "third_party/base/compiler_specific.h"
#include "third_party/base/logging.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
@@ -2639,7 +2639,7 @@ void CXFA_Node::ResetData() {
}
case XFA_FFWidgetType::kChoiceList:
ClearAllSelections();
- FX_FALLTHROUGH;
+ FALLTHROUGH;
default: {
CXFA_Value* defValue = GetDefaultValueIfExists();
if (defValue)