| /* |
| * |
| * Copyright 2025 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. |
| * |
| * Protect Code from unwanted/inconvienet macros |
| * you must follow this pattern when #including port_def.inc in a header file: |
| * |
| * #include "other_header.h" |
| * #include "message.h" |
| * etc. |
| * |
| * #include "port_def.inc" // MUST be last header included |
| * |
| * Definitions for this header. |
| * |
| * #include "port_undef.inc" //At end of file |
| * |
| * This is a textual header with no include guard, because we want to |
| * detect/prohibit anytime it is #included twice without a corresponding |
| * #undef. |
| */ |
| |
| #ifdef GRPC_PORT_ |
| #error "port_def.inc included multiple times" |
| #endif |
| #define GRPC_PORT_ |
| |
| |
| // Windows declares several inconvenient macro names. We #undef them and then |
| // restore them in port_undef.inc. |
| #ifdef _WIN32 |
| #pragma push_macro("CompareString") |
| #undef CompareString |
| #pragma push_macro("CREATE_NEW") |
| #undef CREATE_NEW |
| #pragma push_macro("DELETE") |
| #undef DELETE |
| #pragma push_macro("DOUBLE_CLICK") |
| #undef DOUBLE_CLICK |
| #pragma push_macro("ERROR") |
| #undef ERROR |
| #pragma push_macro("ERROR_BUSY") |
| #undef ERROR_BUSY |
| #pragma push_macro("ERROR_INSTALL_FAILED") |
| #undef ERROR_INSTALL_FAILED |
| #pragma push_macro("ERROR_NOT_FOUND") |
| #undef ERROR_NOT_FOUND |
| #pragma push_macro("ERROR_RETRY") |
| #undef ERROR_RETRY |
| #pragma push_macro("ERROR_TIMEOUT") |
| #undef ERROR_TIMEOUT |
| #pragma push_macro("GetClassName") |
| #undef GetClassName |
| #pragma push_macro("GetCurrentTime") |
| #undef GetCurrentTime |
| #pragma push_macro("GetMessage") |
| #undef GetMessage |
| #pragma push_macro("GetObject") |
| #undef GetObject |
| #pragma push_macro("IGNORE") |
| #undef IGNORE |
| #pragma push_macro("IN") |
| #undef IN |
| #pragma push_macro("INPUT_KEYBOARD") |
| #undef INPUT_KEYBOARD |
| #pragma push_macro("NO_ERROR") |
| #undef NO_ERROR |
| #pragma push_macro("OUT") |
| #undef OUT |
| #pragma push_macro("OPTIONAL") |
| #undef OPTIONAL |
| #pragma push_macro("min") |
| #undef min |
| #pragma push_macro("max") |
| #undef max |
| #pragma push_macro("NEAR") |
| #undef NEAR |
| #pragma push_macro("NO_DATA") |
| #undef NO_DATA |
| #pragma push_macro("REASON_UNKNOWN") |
| #undef REASON_UNKNOWN |
| #pragma push_macro("SERVICE_DISABLED") |
| #undef SERVICE_DISABLED |
| #pragma push_macro("SERVICE_STOP") |
| #undef SERVICE_STOP |
| #pragma push_macro("SEVERITY_ERROR") |
| #undef SEVERITY_ERROR |
| #pragma push_macro("STATUS_PENDING") |
| #undef STATUS_PENDING |
| #pragma push_macro("STRICT") |
| #undef STRICT |
| #pragma push_macro("timezone") |
| #undef timezone |
| #pragma push_macro("TRUE") |
| #undef TRUE |
| #pragma push_macro("FALSE") |
| #undef FALSE |
| #pragma push_macro("UNICODE") |
| #undef UNICODE |
| #endif // _WIN32 |
| |
| #ifdef __APPLE__ |
| // Inconvenient macro names from /usr/include/mach/boolean.h in some macOS SDKs. |
| #pragma push_macro("TRUE") |
| #undef TRUE |
| #pragma push_macro("FALSE") |
| #undef FALSE |
| // Inconvenient macro names from usr/include/sys/syslimits.h in some macOS SDKs. |
| #pragma push_macro("UID_MAX") |
| #undef UID_MAX |
| #pragma push_macro("GID_MAX") |
| #undef GID_MAX |
| // TYPE_BOOL is defined in the MacOS's ConditionalMacros.h. |
| #pragma push_macro("TYPE_BOOL") |
| #undef TYPE_BOOL |
| #endif // __APPLE__ |
| |
| #if defined(ANDROID) || defined(__ANDROID__) |
| // Inconvenient macro names from usr/include/limits.h in some Android NDKs. |
| #pragma push_macro("UID_MAX") |
| #undef UID_MAX |
| #pragma push_macro("GID_MAX") |
| #undef GID_MAX |
| #endif // defined(ANDROID) || defined(__ANDROID__) |
| |