Commit 813f993f authored by Milian Wolff's avatar Milian Wolff
Browse files

Default-initialize data to prevent compiler warning

Fixes:
```
In constructor ‘KDevelop::DUChainReferenceCountingEnabler::DUChainReferenceCountingEnabler(const void*, unsigned int)’,
    inlined from ‘virtual void Utils::StringSetRepository::itemAddedToSets(uint)’ at /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/language/util/setrepository.cpp:1198:100:
/home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/serialization/referencecounting.h:120:39: warning: ‘data’ may be used uninitialized [-Wmaybe-uninitialized]
  120 |         enableDUChainReferenceCounting(m_start, m_size);
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/serialization/referencecounting.h: In member function ‘virtual void Utils::StringSetRepository::itemAddedToSets(uint)’:
/home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/serialization/referencecounting.h:101:39: note: by argument 1 of type ‘const void*’ to ‘void KDevelop::enableDUChainReferenceCounting(const void*, unsigned int)’ declared here
  101 | KDEVPLATFORMSERIALIZATION_EXPORT void enableDUChainReferenceCounting(const void* start, unsigned size);
      |                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/language/util/setrepository.cpp:1196:10: note: ‘data’ declared here
 1196 |     char data[sizeof(KDevelop::IndexedString)];
      |          ^~~~
```
parent b3113021
......@@ -1193,7 +1193,7 @@ void StringSetRepository::itemAddedToSets(uint index)
KDevelop::IndexedString string = KDevelop::IndexedString::fromIndex(index);
char data[sizeof(KDevelop::IndexedString)];
char data[sizeof(KDevelop::IndexedString)] = {};
const KDevelop::DUChainReferenceCountingEnabler rcEnabler(data, sizeof(KDevelop::IndexedString));
new (data) KDevelop::IndexedString(string); //Call constructor with enabled reference-counting
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment