[Openmp-commits] [PATCH] D39755: Remove const from variables with dynamic memory

Jonas Hahnfeld via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Nov 7 12:44:43 PST 2017


Hahnfeld created this revision.

Allocated memory is typically not 'const' if it needs to be freed.
This patch removes around 50 wrong const attributes, modifies the
corresponding functions and finally gets rid of some const_casts.
These have especially been strange for __kmp_str_fname_free() that
added a 'const' to call __kmp_str_free() which removed it again.

Two minor cleanups that I performed in this process:

- __kmp_tool_libraries now lives in kmp_settings.cpp as it is used nowhere else.
- __kmp_msg_empty was removed as it was never used and Clang now complained that it was assigned a string literal that is 'const char *'.


https://reviews.llvm.org/D39755

Files:
  runtime/src/kmp.h
  runtime/src/kmp_dispatch.cpp
  runtime/src/kmp_environment.h
  runtime/src/kmp_error.cpp
  runtime/src/kmp_global.cpp
  runtime/src/kmp_i18n.cpp
  runtime/src/kmp_i18n.h
  runtime/src/kmp_itt.inl
  runtime/src/kmp_sched.cpp
  runtime/src/kmp_settings.cpp
  runtime/src/kmp_str.cpp
  runtime/src/kmp_str.h
  runtime/src/ompt-general.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39755.121958.patch
Type: text/x-patch
Size: 22767 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20171107/ae529e33/attachment-0001.bin>


More information about the Openmp-commits mailing list