Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Port public version macros.
Browse files Browse the repository at this point in the history
This ports https://codereview.chromium.org/959713003/ to
the 4.2 branch.

BUG=v8:3075
LOG=n
R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/953363002

Cr-Commit-Position: refs/branch-heads/4.2@{#3}
Cr-Branched-From: 3dfd929-refs/heads/4.2.77@{#2}
Cr-Branched-From: e011092-refs/heads/master@{#26757}
  • Loading branch information
mi-ac committed Feb 26, 2015
1 parent f1dace6 commit 286b12f
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 26 deletions.
4 changes: 2 additions & 2 deletions PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ def _CommonChecks(input_api, output_api):

def _SkipTreeCheck(input_api, output_api):
"""Check the env var whether we want to skip tree check.
Only skip if src/version.cc has been updated."""
src_version = 'src/version.cc'
Only skip if include/v8-version.h has been updated."""
src_version = 'include/v8-version.h'
FilterFile = lambda file: file.LocalPath() == src_version
if not input_api.AffectedSourceFiles(
lambda file: file.LocalPath() == src_version):
Expand Down
20 changes: 20 additions & 0 deletions include/v8-version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_INCLUDE_VERSION_H_ // V8_VERSION_H_ conflicts with src/version.h
#define V8_INCLUDE_VERSION_H_

// These macros define the version number for the current version.
// NOTE these macros are used by some of the tool scripts and the build
// system so their names cannot be changed without changing the scripts.
#define V8_MAJOR_VERSION 4
#define V8_MINOR_VERSION 2
#define V8_BUILD_NUMBER 77
#define V8_PATCH_LEVEL 2

// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
#define V8_IS_CANDIDATE_VERSION 0

#endif // V8_INCLUDE_VERSION_H_
1 change: 1 addition & 0 deletions include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <stdint.h>
#include <stdio.h>

#include "v8-version.h"
#include "v8config.h"

// We reserve the V8_* prefix for macros defined in V8 public API and
Expand Down
38 changes: 14 additions & 24 deletions src/version.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "include/v8-version.h"
#include "src/v8.h"

#include "src/version.h"

// These macros define the version number for the current version.
// NOTE these macros are used by some of the tool scripts and the build
// system so their names cannot be changed without changing the scripts.
#define MAJOR_VERSION 4
#define MINOR_VERSION 2
#define BUILD_NUMBER 77
#define PATCH_LEVEL 2
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
#define IS_CANDIDATE_VERSION 0

// Define SONAME to have the build system put a specific SONAME into the
// shared library instead the generic SONAME generated from the V8 version
// number. This define is mainly used by the build system script.
#define SONAME ""

#if IS_CANDIDATE_VERSION
#if V8_IS_CANDIDATE_VERSION
#define CANDIDATE_STRING " (candidate)"
#else
#define CANDIDATE_STRING ""
Expand All @@ -31,23 +20,24 @@
#define SX(x) #x
#define S(x) SX(x)

#if PATCH_LEVEL > 0
#define VERSION_STRING \
S(MAJOR_VERSION) "." S(MINOR_VERSION) "." S(BUILD_NUMBER) "." S(PATCH_LEVEL) \
CANDIDATE_STRING
#if V8_PATCH_LEVEL > 0
#define VERSION_STRING \
S(V8_MAJOR_VERSION) "." S(V8_MINOR_VERSION) "." S(V8_BUILD_NUMBER) "." S( \
V8_PATCH_LEVEL) CANDIDATE_STRING
#else
#define VERSION_STRING \
S(MAJOR_VERSION) "." S(MINOR_VERSION) "." S(BUILD_NUMBER) CANDIDATE_STRING
#define VERSION_STRING \
S(V8_MAJOR_VERSION) "." S(V8_MINOR_VERSION) "." S(V8_BUILD_NUMBER) \
CANDIDATE_STRING
#endif

namespace v8 {
namespace internal {

int Version::major_ = MAJOR_VERSION;
int Version::minor_ = MINOR_VERSION;
int Version::build_ = BUILD_NUMBER;
int Version::patch_ = PATCH_LEVEL;
bool Version::candidate_ = (IS_CANDIDATE_VERSION != 0);
int Version::major_ = V8_MAJOR_VERSION;
int Version::minor_ = V8_MINOR_VERSION;
int Version::build_ = V8_BUILD_NUMBER;
int Version::patch_ = V8_PATCH_LEVEL;
bool Version::candidate_ = (V8_IS_CANDIDATE_VERSION != 0);
const char* Version::soname_ = SONAME;
const char* Version::version_string_ = VERSION_STRING;

Expand Down

0 comments on commit 286b12f

Please sign in to comment.