Generate "current" API level.

Support for using this coming in an upcoming patch.

Test: nose2
      readelf to check the following:
      * bsd_signal unversioned before current
      * bsd_signal versioned in current
      * catclose missing before current
      * catclose present and versioned in current
Bug: None
Change-Id: I861862161426d3ec5b530e3156d3a8ae96fed468
diff --git a/cc/gen_stub_libs.py b/cc/gen_stub_libs.py
index 2db8312..eb233f8 100755
--- a/cc/gen_stub_libs.py
+++ b/cc/gen_stub_libs.py
@@ -31,11 +31,30 @@
 )
 
 
+# Arbitrary magic number. We use the same one in api-level.h for this purpose.
+FUTURE_API_LEVEL = 10000
+
+
 def logger():
     """Return the main logger for this module."""
     return logging.getLogger(__name__)
 
 
+def api_level_arg(api_str):
+    """Parses an API level, handling the "current" special case.
+
+    Args:
+        api_str: (string) Either a numeric API level or "current".
+
+    Returns:
+        (int) FUTURE_API_LEVEL if `api_str` is "current", else `api_str` parsed
+        as an integer.
+    """
+    if api_str == "current":
+        return FUTURE_API_LEVEL
+    return int(api_str)
+
+
 def get_tags(line):
     """Returns a list of all tags on this line."""
     _, _, all_tags = line.strip().partition('#')
@@ -105,10 +124,7 @@
             introduced_tag = tag
             arch_specific = True
         elif tag == 'future':
-            # This symbol is not in any released API level.
-            # TODO(danalbert): These need to be emitted for api == current.
-            # That's not a construct we have yet, so just skip it for now.
-            return False
+            return api == FUTURE_API_LEVEL
 
     if introduced_tag is None:
         # We found no "introduced" tags, so the symbol has always been
@@ -310,7 +326,8 @@
     parser.add_argument('-v', '--verbose', action='count', default=0)
 
     parser.add_argument(
-        '--api', type=int, required=True, help='API level being targeted.')
+        '--api', type=api_level_arg, required=True,
+        help='API level being targeted.')
     parser.add_argument(
         '--arch', choices=ALL_ARCHITECTURES, required=True,
         help='Architecture being targeted.')