<commit_before>#
# CMakeCompiler.txt
#
# Copyright (C) 2009-18 by RStudio, Inc.
#
# Unless you have received this program directly from RStudio pursuant
# to the terms of a commercial license agreement with RStudio, then
# this program is licensed to you under the terms of version 3 of the
# GNU Affero General Public License. This program is distributed WITHOUT
# ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
# AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
#
#

# include guard
if(RSTUDIO_CMAKE_COMPILER_INCLUDED)
   return()
endif()
set(RSTUDIO_CMAKE_COMPILER_INCLUDED YES)

# require position independent code for CMake targets
set(CMAKE_POSITION_INDEPENDENT_CODE Yes)

# use clang on osx
if(APPLE)

  if(NOT DEFINED CMAKE_C_COMPILER)
    set(CMAKE_C_COMPILER /usr/bin/cc)
  endif()

  if(NOT DEFINED CMAKE_CXX_COMPILER)
    set(CMAKE_CXX_COMPILER /usr/bin/c++)
  endif()

endif()

# require C++11 (or C++14 for MSVC)
if(MSVC)

  # use C++14 (MSVC doesn't support C++11)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++14")

  # disable C4800 warning; this is very noisy, rarely useful, and was completely removed
  # in Visual Studio 2017 (we're currently using VS 2015).
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800")

  # disable C4091 warning: 'keyword' : ignored on left of 'type' when no variable is declared
  # generates a lot of warning noise in files from clang
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4091")

  # disable C4068 warning: unknown pragma
  # these warnings are being triggered in the MSVC-supplied headers and we aren't touching those
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4068")

  # ensure that we're using linker flags compatible with
  # the version of Boost that will be linked in
  if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
     set(ITERATOR_DEBUG_LEVEL 0)
     set(LINKER_FLAG "/MD")
  else()
     set(ITERATOR_DEBUG_LEVEL 2)
     set(LINKER_FLAG "/MDd")
  endif()

  foreach(RELEASE_TYPE "" "_DEBUG" "_RELEASE" "_MINSIZEREL" "_RELWITHDEBINFO")
    foreach(FLAG CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
      string(REGEX REPLACE "/MDd?" "${LINKER_FLAG}" ${FLAG}${RELEASE_TYPE} "${${FLAG}${RELEASE_TYPE}}")
    endforeach()
  endforeach()

  # disable CMake's automatic manifest generation (we always provide our own)
  foreach(TYPE EXE MODULE SHARED)
    set(CMAKE_${TYPE}_LINKER_FLAGS "${CMAKE_${TYPE}_LINKER_FLAGS} /MANIFEST:NO")
  endforeach()

  # multi-process compilation
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")

  # silence some warnings (mostly out of our control) + set debug level
  add_definitions(
    -D_CRT_NONSTDC_NO_DEPRECATE
    -D_CRT_SECURE_NO_WARNINGS
    -D_SCL_SECURE_NO_WARNINGS
    -D_ITERATOR_DEBUG_LEVEL=${ITERATOR_DEBUG_LEVEL}
    )

else()
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
endif()

if(NOT DEFINED WINDRES)
  set(WINDRES windres.exe)
endif()

# avoid colored output (seems unreliable in cmd.exe terminal)
if(WIN32)
  set(CMAKE_COLOR_MAKEFILE OFF)
endif()
<commit_msg>enable as-needed linking for monitor builds<commit_after>#
# CMakeCompiler.txt
#
# Copyright (C) 2009-18 by RStudio, Inc.
#
# Unless you have received this program directly from RStudio pursuant
# to the terms of a commercial license agreement with RStudio, then
# this program is licensed to you under the terms of version 3 of the
# GNU Affero General Public License. This program is distributed WITHOUT
# ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
# AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
#
#

# include guard
if(RSTUDIO_CMAKE_COMPILER_INCLUDED)
   return()
endif()
set(RSTUDIO_CMAKE_COMPILER_INCLUDED YES)

# require position independent code for CMake targets
set(CMAKE_POSITION_INDEPENDENT_CODE Yes)

# use clang on osx
if(APPLE)

  if(NOT DEFINED CMAKE_C_COMPILER)
    set(CMAKE_C_COMPILER /usr/bin/cc)
  endif()

  if(NOT DEFINED CMAKE_CXX_COMPILER)
    set(CMAKE_CXX_COMPILER /usr/bin/c++)
  endif()

endif()

# require C++11 (or C++14 for MSVC)
if(MSVC)

  # use C++14 (MSVC doesn't support C++11)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++14")

  # disable C4800 warning; this is very noisy, rarely useful, and was completely removed
  # in Visual Studio 2017 (we're currently using VS 2015).
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800")

  # disable C4091 warning: 'keyword' : ignored on left of 'type' when no variable is declared
  # generates a lot of warning noise in files from clang
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4091")

  # disable C4068 warning: unknown pragma
  # these warnings are being triggered in the MSVC-supplied headers and we aren't touching those
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4068")

  # ensure that we're using linker flags compatible with
  # the version of Boost that will be linked in
  if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
     set(ITERATOR_DEBUG_LEVEL 0)
     set(LINKER_FLAG "/MD")
  else()
     set(ITERATOR_DEBUG_LEVEL 2)
     set(LINKER_FLAG "/MDd")
  endif()

  foreach(RELEASE_TYPE "" "_DEBUG" "_RELEASE" "_MINSIZEREL" "_RELWITHDEBINFO")
    foreach(FLAG CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
      string(REGEX REPLACE "/MDd?" "${LINKER_FLAG}" ${FLAG}${RELEASE_TYPE} "${${FLAG}${RELEASE_TYPE}}")
    endforeach()
  endforeach()

  # disable CMake's automatic manifest generation (we always provide our own)
  foreach(TYPE EXE MODULE SHARED)
    set(CMAKE_${TYPE}_LINKER_FLAGS "${CMAKE_${TYPE}_LINKER_FLAGS} /MANIFEST:NO")
  endforeach()

  # multi-process compilation
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")

  # silence some warnings (mostly out of our control) + set debug level
  add_definitions(
    -D_CRT_NONSTDC_NO_DEPRECATE
    -D_CRT_SECURE_NO_WARNINGS
    -D_SCL_SECURE_NO_WARNINGS
    -D_ITERATOR_DEBUG_LEVEL=${ITERATOR_DEBUG_LEVEL}
    )

else()
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
  # Use --as-needed when RSTUDIO_CONFIG_MONITOR_ONLY
  if(RSTUDIO_CONFIG_MONITOR_ONLY)
      foreach(TYPE EXE MODULE SHARED)
        set(CMAKE_${TYPE}_LINKER_FLAGS "${CMAKE_${TYPE}_LINKER_FLAGS} -Wl,--as-needed -Wl,--no-undefined -Wl,--no-allow-shlib-undefined")
      endforeach()
  endif()
endif()

if(NOT DEFINED WINDRES)
  set(WINDRES windres.exe)
endif()

# avoid colored output (seems unreliable in cmd.exe terminal)
if(WIN32)
  set(CMAKE_COLOR_MAKEFILE OFF)
endif()

{'fraction_non_alphanumeric': 0.09984615384615385, 'fraction_numerical': 0.01723076923076923, 'mean_word_length': 4.687664041994751, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7273321', 'n_tokens_mistral': 2469, 'n_tokens_neox': 2228, 'n_words': 643}