[cleanups] Remove `include/grpc/impl/codegen/slice.h` (#31871)

* Remove `include/grpc/impl/codegen/slice.h`

* Automated change: Fix sanity tests

* Automated change: Fix sanity tests

* Automated change: Fix sanity tests
pull/31896/head
Cheng-Yu Chung 2 years ago committed by GitHub
parent b887534111
commit b72da316bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      BUILD
  2. 3
      CMakeLists.txt
  3. 2
      Makefile
  4. 3
      build_autogenerated.yaml
  5. 1
      gRPC-Core.podspec
  6. 1
      grpc.gemspec
  7. 1
      include/grpc/event_engine/slice_buffer.h
  8. 89
      include/grpc/impl/codegen/slice.h
  9. 112
      include/grpc/impl/slice_type.h
  10. 1
      include/grpc/module.modulemap
  11. 2
      include/grpc/slice.h
  12. 1
      package.xml
  13. 2
      src/core/lib/iomgr/python_util.h
  14. 1
      test/core/surface/public_headers_must_be_c89.c
  15. 1
      tools/doxygen/Doxyfile.c++
  16. 1
      tools/doxygen/Doxyfile.c++.internal
  17. 1
      tools/doxygen/Doxyfile.core
  18. 1
      tools/doxygen/Doxyfile.core.internal

@ -217,6 +217,7 @@ GRPC_PUBLIC_HDRS = [
"include/grpc/impl/connectivity_state.h",
"include/grpc/impl/grpc_types.h",
"include/grpc/impl/propagation_bits.h",
"include/grpc/impl/slice_type.h",
]
GRPC_PUBLIC_EVENT_ENGINE_HDRS = [

3
CMakeLists.txt generated

@ -2494,6 +2494,7 @@ foreach(_hdr
include/grpc/impl/connectivity_state.h
include/grpc/impl/grpc_types.h
include/grpc/impl/propagation_bits.h
include/grpc/impl/slice_type.h
include/grpc/load_reporting.h
include/grpc/slice.h
include/grpc/slice_buffer.h
@ -3102,6 +3103,7 @@ foreach(_hdr
include/grpc/impl/connectivity_state.h
include/grpc/impl/grpc_types.h
include/grpc/impl/propagation_bits.h
include/grpc/impl/slice_type.h
include/grpc/load_reporting.h
include/grpc/slice.h
include/grpc/slice_buffer.h
@ -4570,6 +4572,7 @@ foreach(_hdr
include/grpc/impl/connectivity_state.h
include/grpc/impl/grpc_types.h
include/grpc/impl/propagation_bits.h
include/grpc/impl/slice_type.h
include/grpc/load_reporting.h
include/grpc/slice.h
include/grpc/slice_buffer.h

2
Makefile generated

@ -1715,6 +1715,7 @@ PUBLIC_HEADERS_C += \
include/grpc/impl/connectivity_state.h \
include/grpc/impl/grpc_types.h \
include/grpc/impl/propagation_bits.h \
include/grpc/impl/slice_type.h \
include/grpc/load_reporting.h \
include/grpc/slice.h \
include/grpc/slice_buffer.h \
@ -2183,6 +2184,7 @@ PUBLIC_HEADERS_C += \
include/grpc/impl/connectivity_state.h \
include/grpc/impl/grpc_types.h \
include/grpc/impl/propagation_bits.h \
include/grpc/impl/slice_type.h \
include/grpc/load_reporting.h \
include/grpc/slice.h \
include/grpc/slice_buffer.h \

@ -296,6 +296,7 @@ libs:
- include/grpc/impl/connectivity_state.h
- include/grpc/impl/grpc_types.h
- include/grpc/impl/propagation_bits.h
- include/grpc/impl/slice_type.h
- include/grpc/load_reporting.h
- include/grpc/slice.h
- include/grpc/slice_buffer.h
@ -1894,6 +1895,7 @@ libs:
- include/grpc/impl/connectivity_state.h
- include/grpc/impl/grpc_types.h
- include/grpc/impl/propagation_bits.h
- include/grpc/impl/slice_type.h
- include/grpc/load_reporting.h
- include/grpc/slice.h
- include/grpc/slice_buffer.h
@ -3421,6 +3423,7 @@ libs:
- include/grpc/impl/connectivity_state.h
- include/grpc/impl/grpc_types.h
- include/grpc/impl/propagation_bits.h
- include/grpc/impl/slice_type.h
- include/grpc/load_reporting.h
- include/grpc/slice.h
- include/grpc/slice_buffer.h

1
gRPC-Core.podspec generated

@ -147,6 +147,7 @@ Pod::Spec.new do |s|
'include/grpc/impl/connectivity_state.h',
'include/grpc/impl/grpc_types.h',
'include/grpc/impl/propagation_bits.h',
'include/grpc/impl/slice_type.h',
'include/grpc/load_reporting.h',
'include/grpc/slice.h',
'include/grpc/slice_buffer.h',

1
grpc.gemspec generated

@ -90,6 +90,7 @@ Gem::Specification.new do |s|
s.files += %w( include/grpc/impl/connectivity_state.h )
s.files += %w( include/grpc/impl/grpc_types.h )
s.files += %w( include/grpc/impl/propagation_bits.h )
s.files += %w( include/grpc/impl/slice_type.h )
s.files += %w( include/grpc/load_reporting.h )
s.files += %w( include/grpc/slice.h )
s.files += %w( include/grpc/slice_buffer.h )

@ -26,7 +26,6 @@
#include "absl/utility/utility.h"
#include <grpc/event_engine/slice.h>
#include <grpc/impl/codegen/slice.h>
#include <grpc/slice.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/log.h>

@ -21,92 +21,9 @@
// IWYU pragma: private
#include <grpc/impl/codegen/port_platform.h>
#include <grpc/support/port_platform.h>
#include <stddef.h>
typedef struct grpc_slice grpc_slice;
/** Slice API
A slice represents a contiguous reference counted array of bytes.
It is cheap to take references to a slice, and it is cheap to create a
slice pointing to a subset of another slice.
The data-structure for slices is exposed here to allow non-gpr code to
build slices from whatever data they have available.
When defining interfaces that handle slices, care should be taken to define
reference ownership semantics (who should call unref?) and mutability
constraints (is the callee allowed to modify the slice?) */
/* Inlined half of grpc_slice is allowed to expand the size of the overall type
by this many bytes */
#define GRPC_SLICE_INLINE_EXTRA_SIZE sizeof(void*)
#define GRPC_SLICE_INLINED_SIZE \
(sizeof(size_t) + sizeof(uint8_t*) - 1 + GRPC_SLICE_INLINE_EXTRA_SIZE)
struct grpc_slice_refcount;
/** A grpc_slice s, if initialized, represents the byte range
s.bytes[0..s.length-1].
It can have an associated ref count which has a destruction routine to be run
when the ref count reaches zero (see grpc_slice_new() and grp_slice_unref()).
Multiple grpc_slice values may share a ref count.
If the slice does not have a refcount, it represents an inlined small piece
of data that is copied by value.
As a special case, a slice can be given refcount == uintptr_t(1), meaning
that the slice represents external data that is not refcounted. */
struct grpc_slice {
struct grpc_slice_refcount* refcount;
union grpc_slice_data {
struct grpc_slice_refcounted {
size_t length;
uint8_t* bytes;
} refcounted;
struct grpc_slice_inlined {
uint8_t length;
uint8_t bytes[GRPC_SLICE_INLINED_SIZE];
} inlined;
} data;
};
#define GRPC_SLICE_BUFFER_INLINE_ELEMENTS 8
/** Represents an expandable array of slices, to be interpreted as a
single item. */
typedef struct grpc_slice_buffer {
/** This is for internal use only. External users (i.e any code outside grpc
* core) MUST NOT use this field */
grpc_slice* base_slices;
/** slices in the array (Points to the first valid grpc_slice in the array) */
grpc_slice* slices;
/** the number of slices in the array */
size_t count;
/** the number of slices allocated in the array. External users (i.e any code
* outside grpc core) MUST NOT use this field */
size_t capacity;
/** the combined length of all slices in the array */
size_t length;
/** inlined elements to avoid allocations */
grpc_slice inlined[GRPC_SLICE_BUFFER_INLINE_ELEMENTS];
} grpc_slice_buffer;
#define GRPC_SLICE_START_PTR(slice) \
((slice).refcount ? (slice).data.refcounted.bytes \
: (slice).data.inlined.bytes)
#define GRPC_SLICE_LENGTH(slice) \
((slice).refcount ? (slice).data.refcounted.length \
: (slice).data.inlined.length)
#define GRPC_SLICE_SET_LENGTH(slice, newlen) \
((slice).refcount ? ((slice).data.refcounted.length = (size_t)(newlen)) \
: ((slice).data.inlined.length = (uint8_t)(newlen)))
#define GRPC_SLICE_END_PTR(slice) \
GRPC_SLICE_START_PTR(slice) + GRPC_SLICE_LENGTH(slice)
#define GRPC_SLICE_IS_EMPTY(slice) (GRPC_SLICE_LENGTH(slice) == 0)
/// TODO(chengyuc): Remove this file after solving compatibility.
#include <grpc/impl/slice_type.h>
#endif /* GRPC_IMPL_CODEGEN_SLICE_H */

@ -0,0 +1,112 @@
/*
*
* Copyright 2015 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GRPC_IMPL_SLICE_TYPE_H
#define GRPC_IMPL_SLICE_TYPE_H
// IWYU pragma: private, include <grpc/slice.h>
#include <grpc/support/port_platform.h>
#include <stddef.h>
typedef struct grpc_slice grpc_slice;
/** Slice API
A slice represents a contiguous reference counted array of bytes.
It is cheap to take references to a slice, and it is cheap to create a
slice pointing to a subset of another slice.
The data-structure for slices is exposed here to allow non-gpr code to
build slices from whatever data they have available.
When defining interfaces that handle slices, care should be taken to define
reference ownership semantics (who should call unref?) and mutability
constraints (is the callee allowed to modify the slice?) */
/* Inlined half of grpc_slice is allowed to expand the size of the overall type
by this many bytes */
#define GRPC_SLICE_INLINE_EXTRA_SIZE sizeof(void*)
#define GRPC_SLICE_INLINED_SIZE \
(sizeof(size_t) + sizeof(uint8_t*) - 1 + GRPC_SLICE_INLINE_EXTRA_SIZE)
struct grpc_slice_refcount;
/** A grpc_slice s, if initialized, represents the byte range
s.bytes[0..s.length-1].
It can have an associated ref count which has a destruction routine to be run
when the ref count reaches zero (see grpc_slice_new() and grp_slice_unref()).
Multiple grpc_slice values may share a ref count.
If the slice does not have a refcount, it represents an inlined small piece
of data that is copied by value.
As a special case, a slice can be given refcount == uintptr_t(1), meaning
that the slice represents external data that is not refcounted. */
struct grpc_slice {
struct grpc_slice_refcount* refcount;
union grpc_slice_data {
struct grpc_slice_refcounted {
size_t length;
uint8_t* bytes;
} refcounted;
struct grpc_slice_inlined {
uint8_t length;
uint8_t bytes[GRPC_SLICE_INLINED_SIZE];
} inlined;
} data;
};
#define GRPC_SLICE_BUFFER_INLINE_ELEMENTS 8
/** Represents an expandable array of slices, to be interpreted as a
single item. */
typedef struct grpc_slice_buffer {
/** This is for internal use only. External users (i.e any code outside grpc
* core) MUST NOT use this field */
grpc_slice* base_slices;
/** slices in the array (Points to the first valid grpc_slice in the array) */
grpc_slice* slices;
/** the number of slices in the array */
size_t count;
/** the number of slices allocated in the array. External users (i.e any code
* outside grpc core) MUST NOT use this field */
size_t capacity;
/** the combined length of all slices in the array */
size_t length;
/** inlined elements to avoid allocations */
grpc_slice inlined[GRPC_SLICE_BUFFER_INLINE_ELEMENTS];
} grpc_slice_buffer;
#define GRPC_SLICE_START_PTR(slice) \
((slice).refcount ? (slice).data.refcounted.bytes \
: (slice).data.inlined.bytes)
#define GRPC_SLICE_LENGTH(slice) \
((slice).refcount ? (slice).data.refcounted.length \
: (slice).data.inlined.length)
#define GRPC_SLICE_SET_LENGTH(slice, newlen) \
((slice).refcount ? ((slice).data.refcounted.length = (size_t)(newlen)) \
: ((slice).data.inlined.length = (uint8_t)(newlen)))
#define GRPC_SLICE_END_PTR(slice) \
GRPC_SLICE_START_PTR(slice) + GRPC_SLICE_LENGTH(slice)
#define GRPC_SLICE_IS_EMPTY(slice) (GRPC_SLICE_LENGTH(slice) == 0)
#endif /* GRPC_IMPL_SLICE_TYPE_H */

@ -31,6 +31,7 @@ header "byte_buffer.h"
header "impl/connectivity_state.h"
header "impl/grpc_types.h"
header "impl/propagation_bits.h"
header "impl/slice_type.h"
header "load_reporting.h"
header "slice.h"
header "slice_buffer.h"

@ -21,7 +21,7 @@
#include <grpc/support/port_platform.h>
#include <grpc/impl/codegen/slice.h> // IWYU pragma: export
#include <grpc/impl/slice_type.h> // IWYU pragma: export
#include <grpc/support/sync.h>
#ifdef __cplusplus

1
package.xml generated

@ -72,6 +72,7 @@
<file baseinstalldir="/" name="include/grpc/impl/connectivity_state.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/grpc_types.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/propagation_bits.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/slice_type.h" role="src" />
<file baseinstalldir="/" name="include/grpc/load_reporting.h" role="src" />
<file baseinstalldir="/" name="include/grpc/slice.h" role="src" />
<file baseinstalldir="/" name="include/grpc/slice_buffer.h" role="src" />

@ -21,7 +21,7 @@
#include <grpc/support/port_platform.h>
#include <grpc/impl/codegen/slice.h>
#include <grpc/slice.h>
#include <grpc/status.h>
#include "src/core/lib/iomgr/error.h"

@ -45,6 +45,7 @@
#include <grpc/impl/connectivity_state.h>
#include <grpc/impl/grpc_types.h>
#include <grpc/impl/propagation_bits.h>
#include <grpc/impl/slice_type.h>
#include <grpc/load_reporting.h>
#include <grpc/slice.h>
#include <grpc/slice_buffer.h>

@ -918,6 +918,7 @@ include/grpc/impl/compression_types.h \
include/grpc/impl/connectivity_state.h \
include/grpc/impl/grpc_types.h \
include/grpc/impl/propagation_bits.h \
include/grpc/impl/slice_type.h \
include/grpc/load_reporting.h \
include/grpc/slice.h \
include/grpc/slice_buffer.h \

@ -918,6 +918,7 @@ include/grpc/impl/compression_types.h \
include/grpc/impl/connectivity_state.h \
include/grpc/impl/grpc_types.h \
include/grpc/impl/propagation_bits.h \
include/grpc/impl/slice_type.h \
include/grpc/load_reporting.h \
include/grpc/slice.h \
include/grpc/slice_buffer.h \

@ -850,6 +850,7 @@ include/grpc/impl/compression_types.h \
include/grpc/impl/connectivity_state.h \
include/grpc/impl/grpc_types.h \
include/grpc/impl/propagation_bits.h \
include/grpc/impl/slice_type.h \
include/grpc/load_reporting.h \
include/grpc/slice.h \
include/grpc/slice_buffer.h \

@ -850,6 +850,7 @@ include/grpc/impl/compression_types.h \
include/grpc/impl/connectivity_state.h \
include/grpc/impl/grpc_types.h \
include/grpc/impl/propagation_bits.h \
include/grpc/impl/slice_type.h \
include/grpc/load_reporting.h \
include/grpc/slice.h \
include/grpc/slice_buffer.h \

Loading…
Cancel
Save