diff --git a/src/shrpx_exec.cc b/src/shrpx_exec.cc index efff4d68..d5cd0916 100644 --- a/src/shrpx_exec.cc +++ b/src/shrpx_exec.cc @@ -84,7 +84,7 @@ int exec_read_command(Process &proc, char *const argv[]) { rv = shrpx_signal_unblock_all(); if (rv != 0) { - constexpr char msg[] = "Unblocking all signals failed\n"; + static constexpr char msg[] = "Unblocking all signals failed\n"; while (write(STDERR_FILENO, msg, str_size(msg)) == -1 && errno == EINTR) ; nghttp2_Exit(EXIT_FAILURE); @@ -95,7 +95,7 @@ int exec_read_command(Process &proc, char *const argv[]) { rv = execv(argv[0], argv); if (rv == -1) { - constexpr char msg[] = "Could not execute command\n"; + static constexpr char msg[] = "Could not execute command\n"; while (write(STDERR_FILENO, msg, str_size(msg)) == -1 && errno == EINTR) ; nghttp2_Exit(EXIT_FAILURE); diff --git a/src/shrpx_tls_test.cc b/src/shrpx_tls_test.cc index 7445c151..b227dda5 100644 --- a/src/shrpx_tls_test.cc +++ b/src/shrpx_tls_test.cc @@ -70,7 +70,7 @@ void test_shrpx_tls_create_lookup_tree(void) { CU_ASSERT(-1 == tree->lookup(StringRef{})); CU_ASSERT(5 == tree->lookup(hostnames[5])); CU_ASSERT(6 == tree->lookup(hostnames[6])); - constexpr char h6[] = "pdylay.sourceforge.net"; + static constexpr char h6[] = "pdylay.sourceforge.net"; for (int i = 0; i < 7; ++i) { CU_ASSERT(-1 == tree->lookup(StringRef{h6 + i, str_size(h6) - i})); } @@ -119,7 +119,8 @@ void test_shrpx_tls_create_lookup_tree(void) { void test_shrpx_tls_cert_lookup_tree_add_ssl_ctx(void) { int rv; - constexpr char nghttp2_certfile[] = NGHTTP2_SRC_DIR "/test.nghttp2.org.pem"; + static constexpr char nghttp2_certfile[] = + NGHTTP2_SRC_DIR "/test.nghttp2.org.pem"; auto nghttp2_ssl_ctx = SSL_CTX_new(SSLv23_server_method()); auto nghttp2_ssl_ctx_del = defer(SSL_CTX_free, nghttp2_ssl_ctx); auto nghttp2_tls_ctx_data = make_unique(); @@ -129,7 +130,8 @@ void test_shrpx_tls_cert_lookup_tree_add_ssl_ctx(void) { CU_ASSERT(1 == rv); - constexpr char examples_certfile[] = NGHTTP2_SRC_DIR "/test.example.com.pem"; + static constexpr char examples_certfile[] = + NGHTTP2_SRC_DIR "/test.example.com.pem"; auto examples_ssl_ctx = SSL_CTX_new(SSLv23_server_method()); auto examples_ssl_ctx_del = defer(SSL_CTX_free, examples_ssl_ctx); auto examples_tls_ctx_data = make_unique(); diff --git a/src/util.h b/src/util.h index 49d0c4b1..af70a2a4 100644 --- a/src/util.h +++ b/src/util.h @@ -716,7 +716,7 @@ template OutputIt random_alpha_digit(OutputIt first, OutputIt last, Generator &gen) { // If we use uint8_t instead char, gcc 6.2.0 complains by shouting // char-array initialized from wide string. - constexpr char s[] = + static constexpr char s[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; std::uniform_int_distribution<> dis(0, 26 * 2 + 10 - 1); for (; first != last; ++first) {