Ada: cleanup sources (license headers, beautify)

This commit is contained in:
Johannes Kliemann 2018-07-03 15:01:07 +02:00 committed by Norman Feske
parent ddee65722f
commit 0ca197374e
9 changed files with 242 additions and 124 deletions

View File

@ -1,18 +1,31 @@
/*
* \brief Ada exception declarations for C++
* \author Johannes Kliemann
* \date 2018-06-25
*
*/
/*
* Copyright (C) 2018 Componolit GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#include <base/exception.h> #include <base/exception.h>
namespace Ada { namespace Ada {
namespace Exception { namespace Exception {
class Program_Error : Genode::Exception {}; class Program_Error : Genode::Exception {};
class Constraint_Error : Genode::Exception {}; class Constraint_Error : Genode::Exception {};
class Storage_Error : Genode::Exception {}; class Storage_Error : Genode::Exception {};
class Length_Check : Constraint_Error {}; class Length_Check : Constraint_Error {};
class Overflow_Check : Constraint_Error {}; class Overflow_Check : Constraint_Error {};
class Invalid_Data : Constraint_Error {}; class Invalid_Data : Constraint_Error {};
class Range_Check : Constraint_Error {}; class Range_Check : Constraint_Error {};
class Index_Check : Constraint_Error {}; class Index_Check : Constraint_Error {};
class Discriminant_Check : Constraint_Error {}; class Discriminant_Check : Constraint_Error {};
class Divide_By_Zero : Constraint_Error {}; class Divide_By_Zero : Constraint_Error {};
}; }
}; }

View File

@ -1,3 +1,15 @@
--
-- \brief Ada exceptions
-- \author Johannes Kliemann
-- \date 2018-06-25
--
-- Copyright (C) 2018 Genode Labs GmbH
-- Copyright (C) 2018 Componolit GmbH
--
-- This file is part of the Genode OS framework, which is distributed
-- under the terms of the GNU Affero General Public License version 3.
--
package body Ada.Exceptions is package body Ada.Exceptions is
---------------------------- ----------------------------

View File

@ -1,3 +1,15 @@
--
-- \brief Ada exceptions
-- \author Johannes Kliemann
-- \date 2018-06-25
--
-- Copyright (C) 2018 Genode Labs GmbH
-- Copyright (C) 2018 Componolit GmbH
--
-- This file is part of the Genode OS framework, which is distributed
-- under the terms of the GNU Affero General Public License version 3.
--
with System; with System;
package Ada.Exceptions is package Ada.Exceptions is

View File

@ -1,3 +1,15 @@
--
-- \brief Ada secondary stack
-- \author Johannes Kliemann
-- \date 2018-04-16
--
-- Copyright (C) 2018 Genode Labs GmbH
-- Copyright (C) 2018 Componolit GmbH
--
-- This file is part of the Genode OS framework, which is distributed
-- under the terms of the GNU Affero General Public License version 3.
--
package body System.Secondary_Stack is package body System.Secondary_Stack is
procedure SS_Allocate ( procedure SS_Allocate (

View File

@ -1,3 +1,15 @@
--
-- \brief Ada secondary stack
-- \author Johannes Kliemann
-- \date 2018-04-16
--
-- Copyright (C) 2018 Genode Labs GmbH
-- Copyright (C) 2018 Componolit GmbH
--
-- This file is part of the Genode OS framework, which is distributed
-- under the terms of the GNU Affero General Public License version 3.
--
with System.Storage_Elements; with System.Storage_Elements;
with Ss_Utils; with Ss_Utils;
use all type Ss_Utils.Thread; use all type Ss_Utils.Thread;

View File

@ -1,3 +1,18 @@
/*
* \brief Implementation of Ada exception functions, propagating to C++
* \author Alexander Senier
* \author Johannes Kliemann
* \date 2018-04-16
*
*/
/*
* Copyright (C) 2018 Genode Labs GmbH
* Copyright (C) 2018 Componolit GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#include <base/log.h> #include <base/log.h>
#include <util/string.h> #include <util/string.h>
@ -5,98 +20,98 @@
extern "C" { extern "C" {
/* Program Error */ /* Program Error */
void __gnat_rcheck_PE_Explicit_Raise(char *file, int line) void __gnat_rcheck_PE_Explicit_Raise(char *file, int line)
{ {
Genode::error("Program Error in ", Genode::Cstring(file), " at line ", line); Genode::error("Program Error in ", Genode::Cstring(file), " at line ", line);
throw Ada::Exception::Program_Error(); throw Ada::Exception::Program_Error();
} }
/* Constraint Error */ /* Constraint Error */
void constraint_error(char *file, int line) void constraint_error(char *file, int line)
{ {
Genode::error("Constraint Error in ", Genode::Cstring(file), " at line ", line); Genode::error("Constraint Error in ", Genode::Cstring(file), " at line ", line);
throw Ada::Exception::Constraint_Error(); throw Ada::Exception::Constraint_Error();
} }
void __gnat_rcheck_CE_Explicit_Raise(char *file, int line) void __gnat_rcheck_CE_Explicit_Raise(char *file, int line)
{ {
constraint_error(file, line); constraint_error(file, line);
} }
/* Storage Error */ /* Storage Error */
void __gnat_rcheck_SE_Explicit_Raise(char *file, int line) void __gnat_rcheck_SE_Explicit_Raise(char *file, int line)
{ {
Genode::error("Storage Error in ", Genode::Cstring(file), " at line ", line); Genode::error("Storage Error in ", Genode::Cstring(file), " at line ", line);
throw Ada::Exception::Storage_Error(); throw Ada::Exception::Storage_Error();
} }
/* Constraint Error subtypes */ /* Constraint Error subtypes */
/* Length check failed */ /* Length check failed */
void __gnat_rcheck_CE_Length_Check(char *file, int line) void __gnat_rcheck_CE_Length_Check(char *file, int line)
{ {
Genode::error("Constraint Error: Length check failed in ", Genode::error("Constraint Error: Length check failed in ",
Genode::Cstring(file), " at line ", line); Genode::Cstring(file), " at line ", line);
throw Ada::Exception::Length_Check(); throw Ada::Exception::Length_Check();
} }
/* Overflow check failed */ /* Overflow check failed */
void __gnat_rcheck_CE_Overflow_Check(char *file, int line) void __gnat_rcheck_CE_Overflow_Check(char *file, int line)
{ {
Genode::error("Constraint Error: Overflow check failed in ", Genode::error("Constraint Error: Overflow check failed in ",
Genode::Cstring(file), " at line ", line); Genode::Cstring(file), " at line ", line);
throw Ada::Exception::Overflow_Check(); throw Ada::Exception::Overflow_Check();
} }
/* Invalid data */ /* Invalid data */
void __gnat_rcheck_CE_Invalid_Data(char *file, int line) void __gnat_rcheck_CE_Invalid_Data(char *file, int line)
{ {
Genode::error("Constraint Error: Invalid data in ", Genode::error("Constraint Error: Invalid data in ",
Genode::Cstring(file), " at line ", line); Genode::Cstring(file), " at line ", line);
throw Ada::Exception::Invalid_Data(); throw Ada::Exception::Invalid_Data();
} }
/* Range check failed */ /* Range check failed */
void __gnat_rcheck_CE_Range_Check(char *file, int line) void __gnat_rcheck_CE_Range_Check(char *file, int line)
{ {
Genode::error("Constraint Error: Range check failed in ", Genode::error("Constraint Error: Range check failed in ",
Genode::Cstring(file), " at line ", line); Genode::Cstring(file), " at line ", line);
throw Ada::Exception::Range_Check(); throw Ada::Exception::Range_Check();
} }
/* Index check failed */ /* Index check failed */
void __gnat_rcheck_CE_Index_Check(char *file, int line) void __gnat_rcheck_CE_Index_Check(char *file, int line)
{ {
Genode::error("Constraint Error: Index check failed in ", Genode::error("Constraint Error: Index check failed in ",
Genode::Cstring(file), " at line ", line); Genode::Cstring(file), " at line ", line);
throw Ada::Exception::Index_Check(); throw Ada::Exception::Index_Check();
} }
/* Discriminant check failed */ /* Discriminant check failed */
void __gnat_rcheck_CE_Discriminant_Check(char *file, int line) void __gnat_rcheck_CE_Discriminant_Check(char *file, int line)
{ {
Genode::error("Constraint Error: Discriminant check failed in ", Genode::error("Constraint Error: Discriminant check failed in ",
Genode::Cstring(file), " at line ", line); Genode::Cstring(file), " at line ", line);
throw Ada::Exception::Discriminant_Check(); throw Ada::Exception::Discriminant_Check();
} }
/* Divide by 0 */ /* Divide by 0 */
void __gnat_rcheck_CE_Divide_By_Zero (char *file, int line) void __gnat_rcheck_CE_Divide_By_Zero(char *file, int line)
{ {
Genode::error("Constraint Error: Divide by zero in ", Genode::error("Constraint Error: Divide by zero in ",
Genode::Cstring(file), " at line ", line); Genode::Cstring(file), " at line ", line);
throw Ada::Exception::Divide_By_Zero(); throw Ada::Exception::Divide_By_Zero();
} }
void raise_ada_exception(char *name, char *message) void raise_ada_exception(char *name, char *message)
{ {
Genode::error(Genode::Cstring(name), " raised: ", Genode::Cstring(message)); Genode::error(Genode::Cstring(name), " raised: ", Genode::Cstring(message));
} }
void warn_unimplemented_function(char *func) void warn_unimplemented_function(char *func)
{ {
Genode::warning(Genode::Cstring(func), " unimplemented"); Genode::warning(Genode::Cstring(func), " unimplemented");
} }
} }

View File

@ -1,11 +1,25 @@
/*
* \brief Provide dummy for custom Ada exceptions
* \author Johannes Kliemann
* \date 2018-06-25
*
*/
/*
* Copyright (C) 2018 Genode Labs GmbH
* Copyright (C) 2018 Componolit GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#include <base/log.h> #include <base/log.h>
extern "C" { extern "C" {
void system__exception_table__register() void system__exception_table__register()
{ {
Genode::warning(__func__, " not implemented"); Genode::warning(__func__, " not implemented");
} }
} }

View File

@ -1,36 +1,50 @@
/*
* \brief Dummy implementation for Ada softlinks
* \author Johannes Kliemann
* \date 2018-04-16
*
*/
/*
* Copyright (C) 2018 Genode Labs GmbH
* Copyright (C) 2018 Componolit GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#include <base/log.h> #include <base/log.h>
extern "C" { extern "C" {
void system__soft_links__get_current_excep() void system__soft_links__get_current_excep()
{ {
Genode::warning(__func__, " not implemented"); Genode::warning(__func__, " not implemented");
} }
void system__soft_links__get_gnat_exception() void system__soft_links__get_gnat_exception()
{ {
Genode::warning(__func__, " not implemented"); Genode::warning(__func__, " not implemented");
} }
void system__soft_links__get_jmpbuf_address_soft() void system__soft_links__get_jmpbuf_address_soft()
{ {
Genode::warning(__func__, " not implemented"); Genode::warning(__func__, " not implemented");
} }
void system__soft_links__set_jmpbuf_address_soft() void system__soft_links__set_jmpbuf_address_soft()
{ {
Genode::warning(__func__, " not implemented"); Genode::warning(__func__, " not implemented");
} }
void system__soft_links__lock_task() void system__soft_links__lock_task()
{ {
Genode::warning(__func__, " not implemented"); Genode::warning(__func__, " not implemented");
} }
void system__soft_links__unlock_task() void system__soft_links__unlock_task()
{ {
Genode::warning(__func__, " not implemented"); Genode::warning(__func__, " not implemented");
} }
} }

View File

@ -1,3 +1,17 @@
/*
* \brief Test Ada exceptions in C++
* \author Johannes Kliemann
* \date 2018-06-25
*
*/
/*
* Copyright (C) 2018 Genode Labs GmbH
* Copyright (C) 2018 Componolit GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#include <base/log.h> #include <base/log.h>
#include <base/component.h> #include <base/component.h>
@ -6,9 +20,9 @@ extern "C" void except__raise_task();
void Component::construct(Genode::Env &env) void Component::construct(Genode::Env &env)
{ {
Genode::log("Ada exception test"); Genode::log("Ada exception test");
except__raise_task(); except__raise_task();
env.parent().exit(0); env.parent().exit(0);
} }