Commit Graph

303 Commits

Author SHA1 Message Date
Adam Cozzette
72fddb7272 Fixed the Codespell check 2020-11-24 15:02:25 -08:00
Thomas Van Lenten
2f6a7546e4 Update the pod tests to match the new min iOS version. 2020-11-10 11:10:51 -05:00
Thomas Van Lenten
2123ed5df7 Switch to atomic for setting autocreated objects.
- Update semaphore comment to new scope.
- Use an atomic swap to avoid needing to use the semaphore.

This means the semaphore is create only when extension are auto created (less
memory usage).
2020-10-26 11:28:17 -04:00
Thomas Van Lenten
a645d7176b Update the iOS project for Xcode 12.
- Move the min up to iOS 9.  Things should still work with 8, just can't have
  the project set to that and be able to run the tests, so moving it up to
  support running the tests.
- Remove the bitcode setting from the unittest bundle, was causing an error
  with Xcode 12.
2020-10-21 15:42:09 -04:00
Thomas Van Lenten
676ea98902 Update the build/testing script for Xcode 12. 2020-10-21 15:42:09 -04:00
Thomas Van Lenten
9c27f6a479 Add cast to avoid warning on Xcode 12. 2020-10-21 15:42:09 -04:00
Joshua Haberman
32a94ce353 Merge tag 'refs/tags/sync-piper' into sync-stage
# Conflicts:
#	csharp/src/Google.Protobuf.Test/testprotos.pb
2020-08-17 15:26:33 -07:00
Joshua Haberman
95e6c5b474 Sync from Piper @327110949
PROTOBUF_SYNC_PIPER
2020-08-17 15:26:13 -07:00
Peter Newman
e2cc2de304
Fix lots of spelling errors (#7751)
* Fix a typo

* Fix lots of spelling errors

* Fix a few more spelling mistakes

* s/parsable/parseable/

* Don't touch the third party files

* Cloneable is the preferred C# term

* Copyable is the preferred C++ term

* Revert "s/parsable/parseable/"

This reverts commit 534ecf7675.

* Revert unparseable->unparsable corrections
2020-08-10 11:08:25 -07:00
Yannic Bonenberger
8b93b8eae5 [bazel] Move Objective-C runtime into //objectivec
Removing language-specific targets from the top-level BUILD file
will allow users to keep their workspaces smaller and easier to
maintain by not depending on language rules they don't need.

Similar work was done for Java in #7190.
2020-07-20 16:51:30 -07:00
Joshua Haberman
25755efc4f Sync from Piper @319848517
PROTOBUF_SYNC_PIPER
2020-07-06 13:54:50 -07:00
Joshua Haberman
f77065d4eb Sync from Piper @316511779
PROTOBUF_SYNC_PIPER
2020-06-15 11:48:47 -07:00
Thomas Van Lenten
9f546ba61b ObjC Support a runtime import override.
Option to add a prefix to generated #imports incase ObjC Protos are
used in a build system where one wants to avoid adding a header
search path and have more complete imports.
2020-06-09 13:05:50 -04:00
Joshua Haberman
b971243fe0 Merge branch '3.12.x' into merge-release-branch 2020-06-02 13:24:30 -07:00
Thomas Van Lenten
2360bacd12 Tweak the union used for Extensions to support old generated code.
Support the old field name as well as the union to keep the old generated code
building.

Fixes #7555
2020-05-28 15:02:31 -04:00
Joshua Haberman
0a737d8eb0 Sync from Piper @313142438
PROTOBUF_SYNC_PIPER
2020-05-26 00:26:15 -07:00
Joshua Haberman
1e8d04061c Remove includes of deleted "no_arena" protos from ObjC. 2020-05-13 16:31:53 -07:00
Joshua Haberman
c8fce07914 Removed "no_arena" variants from the build system. 2020-05-13 13:49:35 -07:00
Joshua Haberman
6ed738305b Sync from Piper @311396324
PROTOBUF_SYNC_PIPER
2020-05-13 13:46:15 -07:00
Dave MacLachlan
118589c565 Remove unnecessary call to [self descriptor] in resolveClassMethod:
This was causing problems in OCMock due to recursion when OCMock was trying
to mock a protobuf.

`_forwardStackInvocation:` was being called as part of the resolution of `descriptor`.
2020-05-11 11:31:58 -04:00
Joshua Haberman
32e5deb1ac Sync from Piper @308829107
PROTOBUF_SYNC_PIPER
2020-04-28 08:40:38 -07:00
Thomas Van Lenten
dddeed298b [ObjC] Typos and comment improvements. 2020-04-24 16:36:15 -04:00
Thomas Van Lenten
7b6016e343 [ObjC] Add tests for proto3 optional behaviors. 2020-04-24 16:36:15 -04:00
Thomas Van Lenten
b0e2792842 [ObjC] Generation changes around proto3 optional.
- Bump the version marker in the generated code.
- Set the flag to say clear on zero is known.
- Set clear on zero for proto3 optional fields that aren't tagged as optional.
- Also tweak the call from some C generated code to use different apis with
  better validation.
- Mark the ObjC generator as supporting the proto3 optional feature.
- Regenerate the WKTs to get the new flags.
2020-04-24 16:36:15 -04:00
Thomas Van Lenten
3c8e959b60 [ObjC] Update oneof clearing internals.
- Add/document an public api for clearing oneofs.
- Move the current library internals to a new api and keep a shim for old
  generated code.
2020-04-24 16:36:15 -04:00
Thomas Van Lenten
e1e5b8af79 [ObjC] Update some library internals to not pass syntax versions.
- With the new flags, the syntax isn't needed, so don't pass it.
- To keep library binary compatibility, rename the helpers since one
  "Internal" method was called from generated code. Keep a shim with
  the old signature to support those generated sources.
2020-04-24 16:36:15 -04:00
Thomas Van Lenten
8d224b4c48 [ObjC] Runtime support for proto3 optional.
- Add a Descriptor flag to capture if the field should clear on being zeroed.
- Update the runtime to use the new clear on zero flag.
- Add a flag on message initialization to indicate the sources were generated
  with/without this support so the runtime can backfill the flag for older
  generated sources.
2020-04-24 16:36:15 -04:00
Thomas Van Lenten
e9b0c92659 [ObjC] Update oneof generation for proto3 optional.
- Don't make an OneofGenerator for synthetic oneofs.
- Update the field calculations that determine if hasbits are needed to
  know about synthetic oneofs and ignore them.
2020-04-24 16:36:15 -04:00
Joshua Haberman
bb30225f06 Sync from Piper @307316823
PROTOBUF_SYNC_PIPER
2020-04-19 18:01:44 -07:00
Thomas Van Lenten
7b8a241b57 [ObjC] Improve validation on public apis. 2020-04-15 13:22:05 -04:00
Thomas Van Lenten
95282469eb [ObjC] Remove helper to avoid extra lookups.
Skip the helper that fetches the desc again since these methods already
collected it.
2020-04-15 13:22:05 -04:00
Joshua Haberman
74ad62759e Sync from Piper @306496510
PROTOBUF_SYNC_PIPER
2020-04-14 12:55:41 -07:00
Thomas Van Lenten
6f3bda22f4 [ObjC] Fix some tests checking the wrong Message class. 2020-04-14 12:15:23 -04:00
Thomas Van Lenten
24dda9e233 Update the build/test script for newer Xcode 11 versions
Apple stopped really supporting the 32bit simulators, so don't try
running those any more.
2020-04-14 12:15:23 -04:00
Thomas Van Lenten
56c48ae592 Revisit how the WKTs are bundled with ObjC.
There are have been a few issues around people using case sensitive file systems
what Xcode/clang does when looking at the paths. In attempts to solve one set of
warnings, new warnings/errors happened in different setup. So, to hopefully put
these problem away for got, move the WKTs to be at the same level as the other
headers.

- Revert "Override CocoaPods module to lowercase (#6464)"
  This reverts commit 479ba8226b.
- Move WKTs to the objectivec directory and make the old headers shim back to
  the new locations.
- Update objectivec/generate_well_known_types.sh to check them one at a time
  and to deal with the new locations for them.

Fixes #6803
2020-02-10 12:20:05 -05:00
Dave MacLachlan
302f3ea1e5 Update GOOGLE_PROTOBUF_OBJC_VERSION to 30003 2020-01-30 13:08:32 -05:00
Dave MacLachlan
f4a6b99339 Block subclassing
Add GPB_FINAL macro to block subclassing of generated ObjC classes.
2020-01-24 11:51:37 -05:00
dmaclach
6f9d488149 Move min Xcode version to 10.3
Xcode 10.1 has a compiler bug that breaks on generated code.
Xcode 10.3+ appear to be fine.
2020-01-23 16:43:00 -05:00
Thomas Van Lenten
edf69e5858 Make the unittest proto file generation handle additions better.
Didn't really handle when a file was missing, but all the other were up to date,
this handles that case also.
2020-01-23 08:30:51 -05:00
Dave MacLachlan
ab48ecf140 Update pddm to work with clang-format
Add clang-format off/on directives around pddm expansions to simplify formatting other code.
2020-01-21 13:14:01 -05:00
Dave MacLachlan
aa1d7e7c48 Change Objective C class references to using macros.
Allows easy replacing of class names in generated code using #define to redefine class names at compile time.
2020-01-21 12:12:11 -05:00
Dave MacLachlan
74956e1c15 Use references to Objective C classes instead of looking classes up by name.
This should reduce binary size slightly, small performance improvement, and improve linkage by forcing references to all used classes.

Note that this maintains backwards compatibility for sources generated by older protoc for the time being. If you want the benefits
you will need to recompile your protos with the newer protoc.
2020-01-15 15:01:53 -05:00
Brian Wignall
a104dffcb6 Fix typos (#7050)
Uses https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines to find likely typos, with https://github.com/bwignall/typochecker to help automate the checking.
2020-01-08 10:18:20 -08:00
Thomas Van Lenten
065fa2f395 Remove use of VLA.
VLAs complicate static analysis and bloat stack size. Replace VLA allocation
with calls to malloc and free.  This will alos the code to build with -Wvla.
2019-12-10 17:31:25 -05:00
Rafi Kamal
58d4420e2d Down Integrate Internal Changes 2019-11-12 13:38:58 -08:00
Thomas Van Lenten
668eb3b4e6 Fix decoding of overencoded booleans.
if the value was >32bit with the low bits all being zero, it was decoded as
false instead of as true.

Fixes #6863
2019-11-08 17:56:45 -05:00
Thomas Van Lenten
f6eeb435bf General Xcode 11 support for picking iOS simulators to test against. 2019-11-04 11:20:35 -05:00
dmaclach
4702ba9043 Remove OSReadLittle* due to alignment requirements (#6678)
The OSReadLittleInt64 function as defined by Apple reduces down to:

`return *(volatile uint64_t *)((uintptr_t)base + byteOffset);`

which means we are type-punning using a cast. On ARMv7 and other aligned architectures this can cause crashes. 
Minimal example: https://gist.github.com/dmaclach/b10b0a71ae614d304c067cb9bd264336

Fixes #6679
2019-09-20 11:19:45 -04:00
Thomas Van Lenten
5846439713
[ObjC] Don't use unions and instead use memcpy for the type swaps. (#6672)
The code in question hasn't change in a long time so the cause of
https://github.com/firebase/firebase-ios-sdk/issues/3851 still appears to be
an Xcode 11 clang change/bug; but this does appear to be slightly better
code for the work being done.

Cleanup along the way for #6679
2019-09-20 10:52:34 -04:00
Thomas Van Lenten
030a38b954 Fix typo that snuck in with last commit. 2019-08-30 11:43:08 -04:00