Bug Summary

File:var/lib/jenkins/workspace/firefox-scan-build/dom/debugger/CallbackDebuggerNotification.h
Warning:line 70, column 21
Value stored to 'typeStr' during its initialization is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name Unified_cpp_dom_debugger0.cpp -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -relaxed-aliasing -ffp-contract=off -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dom/debugger -fcoverage-compilation-dir=/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dom/debugger -resource-dir /usr/lib/llvm-19/lib/clang/19 -include /var/lib/jenkins/workspace/firefox-scan-build/config/gcc_hidden.h -include /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/mozilla-config.h -I /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/stl_wrappers -I /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/system_wrappers -U _FORTIFY_SOURCE -D _FORTIFY_SOURCE=2 -D DEBUG=1 -D MOZ_HAS_MOZGLUE -D MOZILLA_INTERNAL_API -D IMPL_LIBXUL -D MOZ_SUPPORT_LEAKCHECKING -D STATIC_EXPORTABLE_JS_API -I /var/lib/jenkins/workspace/firefox-scan-build/dom/debugger -I /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dom/debugger -I /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include -I /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/nspr -I /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/nss -D MOZILLA_CLIENT -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/x86_64-linux-gnu/c++/14 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/backward -internal-isystem /usr/lib/llvm-19/lib/clang/19/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-error=tautological-type-limit-compare -Wno-invalid-offsetof -Wno-range-loop-analysis -Wno-deprecated-anon-enum-enum-conversion -Wno-deprecated-enum-enum-conversion -Wno-deprecated-this-capture -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=free-nonheap-object -Wno-error=atomic-alignment -Wno-error=deprecated-builtins -Wno-psabi -Wno-error=builtin-macro-redefined -Wno-vla-cxx-extension -Wno-unknown-warning-option -fdeprecated-macro -ferror-limit 19 -fstrict-flex-arrays=1 -stack-protector 2 -fstack-clash-protection -ftrivial-auto-var-init=pattern -fno-rtti -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fno-sized-deallocation -fno-aligned-allocation -vectorize-loops -vectorize-slp -analyzer-checker optin.performance.Padding -analyzer-output=html -analyzer-config stable-report-filename=true -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/scan-build-2024-09-22-115206-3586786-1 -x c++ Unified_cpp_dom_debugger0.cpp
1/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3/* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7#ifndef mozilla_dom_CallbackDebuggerNotification_h
8#define mozilla_dom_CallbackDebuggerNotification_h
9
10#include "DebuggerNotification.h"
11#include "DebuggerNotificationManager.h"
12#include "mozilla/CycleCollectedJSContext.h"
13
14namespace mozilla::dom {
15
16class CallbackDebuggerNotification : public DebuggerNotification {
17 public:
18 NS_DECL_ISUPPORTS_INHERITEDpublic: virtual nsresult QueryInterface(const nsIID& aIID
, void** aInstancePtr) override; virtual MozExternalRefCountType
AddRef(void) override; virtual MozExternalRefCountType Release
(void) override;
19 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(CallbackDebuggerNotification,class cycleCollection : public DebuggerNotification::cycleCollection
{ public: constexpr explicit cycleCollection(Flags aFlags = 0
) : DebuggerNotification::cycleCollection(aFlags) {} private:
public: virtual nsresult TraverseNative(void* p, nsCycleCollectionTraversalCallback
& cb) override; virtual const char* ClassName() override {
return "CallbackDebuggerNotification"; }; static CallbackDebuggerNotification
* Downcast(nsISupports* s) { return static_cast<CallbackDebuggerNotification
*>(static_cast<DebuggerNotification*>( DebuggerNotification
::cycleCollection::Downcast(s))); } virtual void Unlink(void*
p) override; static constexpr nsXPCOMCycleCollectionParticipant
* GetParticipant() { return &CallbackDebuggerNotification
::_cycleCollectorGlobal; } }; virtual void CheckForRightParticipant
() override { nsXPCOMCycleCollectionParticipant* p; CallQueryInterface
(this, &p); do { static_assert( mozilla::detail::AssertionConditionType
<decltype(p == &_cycleCollectorGlobal)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(p == &_cycleCollectorGlobal
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"p == &_cycleCollectorGlobal" " (" "CallbackDebuggerNotification"
" should QI to its own CC participant" ")", "/var/lib/jenkins/workspace/firefox-scan-build/dom/debugger/CallbackDebuggerNotification.h"
, 20); AnnotateMozCrashReason("MOZ_ASSERT" "(" "p == &_cycleCollectorGlobal"
") (" "CallbackDebuggerNotification" " should QI to its own CC participant"
")"); do { *((volatile int*)__null) = 20; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false); } static cycleCollection
_cycleCollectorGlobal;
20 DebuggerNotification)class cycleCollection : public DebuggerNotification::cycleCollection
{ public: constexpr explicit cycleCollection(Flags aFlags = 0
) : DebuggerNotification::cycleCollection(aFlags) {} private:
public: virtual nsresult TraverseNative(void* p, nsCycleCollectionTraversalCallback
& cb) override; virtual const char* ClassName() override {
return "CallbackDebuggerNotification"; }; static CallbackDebuggerNotification
* Downcast(nsISupports* s) { return static_cast<CallbackDebuggerNotification
*>(static_cast<DebuggerNotification*>( DebuggerNotification
::cycleCollection::Downcast(s))); } virtual void Unlink(void*
p) override; static constexpr nsXPCOMCycleCollectionParticipant
* GetParticipant() { return &CallbackDebuggerNotification
::_cycleCollectorGlobal; } }; virtual void CheckForRightParticipant
() override { nsXPCOMCycleCollectionParticipant* p; CallQueryInterface
(this, &p); do { static_assert( mozilla::detail::AssertionConditionType
<decltype(p == &_cycleCollectorGlobal)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(p == &_cycleCollectorGlobal
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"p == &_cycleCollectorGlobal" " (" "CallbackDebuggerNotification"
" should QI to its own CC participant" ")", "/var/lib/jenkins/workspace/firefox-scan-build/dom/debugger/CallbackDebuggerNotification.h"
, 20); AnnotateMozCrashReason("MOZ_ASSERT" "(" "p == &_cycleCollectorGlobal"
") (" "CallbackDebuggerNotification" " should QI to its own CC participant"
")"); do { *((volatile int*)__null) = 20; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false); } static cycleCollection
_cycleCollectorGlobal;
21
22 CallbackDebuggerNotification(nsIGlobalObject* aDebuggeeGlobal,
23 DebuggerNotificationType aType,
24 CallbackDebuggerNotificationPhase aPhase,
25 nsIGlobalObject* aOwnerGlobal = nullptr)
26 : DebuggerNotification(aDebuggeeGlobal, aType, aOwnerGlobal),
27 mPhase(aPhase) {}
28
29 // nsWrapperCache
30 virtual JSObject* WrapObject(JSContext* aCx,
31 JS::Handle<JSObject*> aGivenProto) override;
32
33 already_AddRefed<DebuggerNotification> CloneInto(
34 nsIGlobalObject* aNewOwner) const override;
35
36 CallbackDebuggerNotificationPhase Phase() const { return mPhase; }
37
38 protected:
39 ~CallbackDebuggerNotification() = default;
40
41 CallbackDebuggerNotificationPhase mPhase;
42};
43
44class MOZ_RAII CallbackDebuggerNotificationGuard final {
45 public:
46 MOZ_CAN_RUN_SCRIPT CallbackDebuggerNotificationGuard(
47 nsIGlobalObject* aDebuggeeGlobal, DebuggerNotificationType aType)
48 : mDebuggeeGlobal(aDebuggeeGlobal), mType(aType) {
49 Dispatch(CallbackDebuggerNotificationPhase::Pre);
50 }
51 CallbackDebuggerNotificationGuard(const CallbackDebuggerNotificationGuard&) =
52 delete;
53 CallbackDebuggerNotificationGuard(CallbackDebuggerNotificationGuard&&) =
54 delete;
55 CallbackDebuggerNotificationGuard& operator=(
56 const CallbackDebuggerNotificationGuard&) = delete;
57 CallbackDebuggerNotificationGuard& operator=(
58 CallbackDebuggerNotificationGuard&&) = delete;
59
60 MOZ_CAN_RUN_SCRIPT ~CallbackDebuggerNotificationGuard() {
61 Dispatch(CallbackDebuggerNotificationPhase::Post);
62 }
63
64 private:
65 MOZ_CAN_RUN_SCRIPT void Dispatch(CallbackDebuggerNotificationPhase aPhase) {
66 auto manager = DebuggerNotificationManager::ForDispatch(mDebuggeeGlobal);
67 if (MOZ_UNLIKELY(manager)(__builtin_expect(!!(manager), 0))) {
68 CycleCollectedJSContext* ccjcx = CycleCollectedJSContext::Get();
69 if (ccjcx) {
70 const char* typeStr = "";
Value stored to 'typeStr' during its initialization is never read
71 switch (mType) {
72 case DebuggerNotificationType::SetTimeout:
73 typeStr = "setTimeout";
74 break;
75 case DebuggerNotificationType::ClearTimeout:
76 typeStr = "clearTimeout";
77 break;
78 case DebuggerNotificationType::SetInterval:
79 typeStr = "setInterval";
80 break;
81 case DebuggerNotificationType::ClearInterval:
82 typeStr = "clearInterval";
83 break;
84 case DebuggerNotificationType::RequestAnimationFrame:
85 typeStr = "requestAnimationFrame";
86 break;
87 case DebuggerNotificationType::CancelAnimationFrame:
88 typeStr = "cancelAnimationFrame";
89 break;
90 case DebuggerNotificationType::SetTimeoutCallback:
91 typeStr = "setTimeout";
92 break;
93 case DebuggerNotificationType::SetIntervalCallback:
94 typeStr = "setInterval";
95 break;
96 case DebuggerNotificationType::RequestAnimationFrameCallback:
97 typeStr = "requestAnimationFrame";
98 break;
99 case DebuggerNotificationType::DomEvent:
100 MOZ_CRASH("Unreachable")do { do { } while (false); MOZ_ReportCrash("" "Unreachable", "/var/lib/jenkins/workspace/firefox-scan-build/dom/debugger/CallbackDebuggerNotification.h"
, 100); AnnotateMozCrashReason("MOZ_CRASH(" "Unreachable" ")"
); do { *((volatile int*)__null) = 100; __attribute__((nomerge
)) ::abort(); } while (false); } while (false)
;
101 break;
102 }
103 if (aPhase == CallbackDebuggerNotificationPhase::Pre) {
104 JS_TracerEnterLabelLatin1(ccjcx->Context(), typeStr);
105 } else {
106 JS_TracerLeaveLabelLatin1(ccjcx->Context(), typeStr);
107 }
108 }
109
110 manager->Dispatch<CallbackDebuggerNotification>(mType, aPhase);
111 }
112 }
113
114 nsIGlobalObject* mDebuggeeGlobal;
115 DebuggerNotificationType mType;
116};
117
118} // namespace mozilla::dom
119
120#endif // mozilla_dom_CallbackDebuggerNotification_h