bazel: Make pw_cc_library an alias for cc_library

This is done by removing the last modification that pw_cc_library
applied on top of cc_library, i.e. setting `linkstatic` to `True`. This
is safe for Bazel users, because the toolchains we define in Pigweed
don't have a `supports_dynamic_linker` feature (so `linkstatic` is a
no-op). The internal host toolchain does have this feature, but I
verified that nothing breaks with this change (cl/579948365).

Followup CLs will replace all `pw_cc_library` instances with native
`cc_library`, allowing us to finally retire this macro.

Bug: b/267498492
Change-Id: I0ab501ffb5e7298962a2dc3ad2352348c3a561a3
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/178924
Reviewed-by: Armando Montanez <amontanez@google.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ted Pudlik <tpudlik@google.com>
diff --git a/pw_build/bazel_internal/pigweed_internal.bzl b/pw_build/bazel_internal/pigweed_internal.bzl
index 0276fcd..b8b4afb 100644
--- a/pw_build/bazel_internal/pigweed_internal.bzl
+++ b/pw_build/bazel_internal/pigweed_internal.bzl
@@ -17,16 +17,6 @@
 
 load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain")
 
-def add_defaults(kwargs):
-    """Adds default arguments suitable for both C and C++ code to kwargs.
-
-    Args:
-        kwargs: cc_* arguments to be modified.
-    """
-
-    # Set linkstatic to avoid building .so files.
-    kwargs["linkstatic"] = True
-
 def _print_platform_impl(_, ctx):
     if hasattr(ctx.rule.attr, "constraint_values"):
         for cv in ctx.rule.attr.constraint_values:
diff --git a/pw_build/pigweed.bzl b/pw_build/pigweed.bzl
index d6c1cf8..2192445 100644
--- a/pw_build/pigweed.bzl
+++ b/pw_build/pigweed.bzl
@@ -18,7 +18,6 @@
 load("@rules_cc//cc:action_names.bzl", "C_COMPILE_ACTION_NAME")
 load(
     "//pw_build/bazel_internal:pigweed_internal.bzl",
-    _add_defaults = "add_defaults",
     _compile_cc = "compile_cc",
 )
 
@@ -31,12 +30,8 @@
 def pw_cc_binary(**kwargs):
     """Wrapper for cc_binary providing some defaults.
 
-    Specifically, this wrapper,
-
-    *  Adds default copts.
-    *  Adds a dep on the pw_assert backend.
-    *  Sets "linkstatic" to True.
-    *  Disables header modules (via the feature -use_header_modules).
+    Specifically, this wrapper adds deps on backend_impl targets for pw_assert
+    and pw_log.
 
     Args:
       **kwargs: Passed to cc_binary.
@@ -48,22 +43,17 @@
     # the build.
     kwargs["deps"] = kwargs["deps"] + ["@pigweed//targets:pw_assert_backend_impl"]
     kwargs["deps"] = kwargs["deps"] + ["@pigweed//pw_log:backend_impl"]
-    _add_defaults(kwargs)
     native.cc_binary(**kwargs)
 
 def pw_cc_library(**kwargs):
-    """Wrapper for cc_library providing some defaults.
+    """Wrapper for cc_library.
 
-    Specifically, this wrapper,
-
-    *  Adds default copts.
-    *  Sets "linkstatic" to True.
-    *  Disables header modules (via the feature -use_header_modules).
+    TODO: b/267498492 - This wrapper no longer does anything. Remove it once
+    all projects have been migrated off of it.
 
     Args:
       **kwargs: Passed to cc_library.
     """
-    _add_defaults(kwargs)
     native.cc_library(**kwargs)
 
 def pw_cc_test(**kwargs):
@@ -71,11 +61,8 @@
 
     Specifically, this wrapper,
 
-    *  Adds default copts.
     *  Adds a dep on the pw_assert backend.
     *  Adds a dep on //pw_unit_test:simple_printing_main
-    *  Sets "linkstatic" to True.
-    *  Disables header modules (via the feature -use_header_modules).
 
     In addition, a .lib target is created that's a cc_library with the same
     kwargs. Such library targets can be used as dependencies of firmware images
@@ -94,7 +81,6 @@
     # way to handle the facades without introducing a circular dependency into
     # the build.
     kwargs["deps"] = kwargs["deps"] + ["@pigweed//targets:pw_assert_backend_impl"]
-    _add_defaults(kwargs)
 
     # Some tests may include FuzzTest, which includes headers that trigger
     # warnings. This check must be done here and not in `add_defaults`, since
@@ -135,11 +121,8 @@
 
     This macro produces a cc_binary and,
 
-    *  Adds default copts.
     *  Adds a dep on the pw_assert backend.
     *  Adds a dep on //pw_perf_test:logging_main
-    *  Sets "linkstatic" to True.
-    *  Disables header modules (via the feature -use_header_modules).
 
     Args:
       **kwargs: Passed to cc_binary.
@@ -147,7 +130,6 @@
     kwargs["deps"] = kwargs.get("deps", []) + \
                      ["@pigweed//pw_perf_test:logging_main"]
     kwargs["deps"] = kwargs["deps"] + ["@pigweed//targets:pw_assert_backend_impl"]
-    _add_defaults(kwargs)
     native.cc_binary(**kwargs)
 
 def pw_cc_facade(**kwargs):
@@ -160,7 +142,6 @@
     if "srcs" in kwargs.keys():
         fail("'srcs' attribute does not exist in pw_cc_facade, please use \
         main implementing target.")
-    _add_defaults(kwargs)
     native.cc_library(**kwargs)
 
 def host_backend_alias(name, backend):
diff --git a/pw_fuzzer/fuzzer.bzl b/pw_fuzzer/fuzzer.bzl
index 6401ad2..df9e103 100644
--- a/pw_fuzzer/fuzzer.bzl
+++ b/pw_fuzzer/fuzzer.bzl
@@ -14,10 +14,6 @@
 """Utilities for fuzzing."""
 
 load("@rules_fuzzing//fuzzing:cc_defs.bzl", "cc_fuzz_test")
-load(
-    "//pw_build/bazel_internal:pigweed_internal.bzl",
-    _add_defaults = "add_defaults",
-)
 
 def pw_cc_fuzz_test(**kwargs):
     """Wrapper for cc_fuzz_test that adds required Pigweed dependencies.
@@ -34,5 +30,4 @@
 
     # TODO: b/292628774 - Only linux is supported for now.
     kwargs["target_compatible_with"] = ["@platforms//os:linux"]
-    _add_defaults(kwargs)
     cc_fuzz_test(**kwargs)